Skip to content

Commit 80c2ac8

Browse files
committed
Fix undefined property access on EmptyMduiElement
# If applied, this commit will Prevent a fatal/warning-level PHP error when serializing IdP metadata for an entity that has no mdui:Logo configured. # Why is this change needed? Prior to this change, JsonHelper::serializeIdentityProvider() always accessed height, width and url on the value returned by getMdui()->getLogo(), assuming it is always a Logo instance. When an IdP has no logo, an EmptyMduiElement is returned instead, which did not declare these properties. On PHP 8.2+ this produces "Undefined property" warnings that get written to the response body before the JSON payload, corrupting the API response for any consumer (such as Profile) calling the metadata/idp endpoint for that entity. # How does it address the issue? This change adds public height, width and url properties (default null) to EmptyMduiElement so it is structurally compatible with Logo wherever the two are used interchangeably, without altering its existing public API or JSON representation. # Provide links to any relevant tickets, articles or other resources Found while manually testing the WAYF remember-my-choice epic end-to-end against a mock IdP without a configured logo.
1 parent 2a2a58d commit 80c2ac8

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

‎src/OpenConext/EngineBlock/Metadata/EmptyMduiElement.php‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@ class EmptyMduiElement implements MultilingualElement, JsonSerializable
3131
{
3232
private $name;
3333

34+
public $height = null;
35+
public $width = null;
36+
public $url = null;
37+
3438
public function __construct(string $name)
3539
{
3640
$this->name = $name;

0 commit comments

Comments
 (0)