Skip to content

feat: return SamlMessage from binding receive() method#105

Merged
william-suppo merged 1 commit into
masterfrom
feat/binding-receive-return-message
Jun 26, 2026
Merged

feat: return SamlMessage from binding receive() method#105
william-suppo merged 1 commit into
masterfrom
feat/binding-receive-return-message

Conversation

@william-suppo

Copy link
Copy Markdown
Contributor

Summary

  • AbstractBinding::receive() now returns SamlMessage instead of void
  • Both HttpPostBinding and HttpRedirectBinding return the deserialized message

Context

The official documentation example showed:

$response = $binding->receive($request, $messageContext);
print $response->getID(); // Fatal error: $response is null

Since receive() returned void, $response was always null. Users had to know to call $messageContext->getMessage() instead — which is not documented.

With this change, both patterns work:

// New: assign directly from receive()
$message = $binding->receive($request, $messageContext);

// Existing: still works unchanged
$binding->receive($request, $messageContext);
$message = $messageContext->getMessage();

This is non-breaking: existing code that ignores the return value continues to work.

Closes #89

Previously receive() returned void, requiring callers to retrieve the
message separately via $messageContext->getMessage(). The official
documentation example incorrectly showed assigning the return value,
leading to a null reference error.

Return the deserialized SamlMessage directly from receive() so that
both usage patterns work:

  $message = $binding->receive($request, $messageContext);
  // or
  $binding->receive($request, $messageContext);
  $message = $messageContext->getMessage();

Closes #89
@william-suppo william-suppo merged commit 92c16fa into master Jun 26, 2026
9 checks passed
@william-suppo william-suppo deleted the feat/binding-receive-return-message branch June 26, 2026 07:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

The Receive Message Example on the WebSite is Insufficient to Build an ACS Interface

1 participant