Skip to content

Fix GH-23447: segfault when the SoapServer class fails to initialize - #23448

Open
lazerg wants to merge 2 commits into
php:PHP-8.4from
lazerg:fix/gh-23447-soap-object-init
Open

Fix GH-23447: segfault when the SoapServer class fails to initialize#23448
lazerg wants to merge 2 commits into
php:PHP-8.4from
lazerg:fix/gh-23447-soap-object-init

Conversation

@lazerg

@lazerg lazerg commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

SoapServer::handle() ignored the return value of object_init_ex(), so when the class given to setClass() could not be instantiated the code carried on with a NULL zval and crashed on Z_OBJCE_P(soap_obj). That happens for instance when a property default references an undefined constant, since evaluating it throws an Error and object creation fails.

Now the failure is reported as a SOAP fault, the same way a throwing constructor already is.

Fixes #23447

--TEST--
GH-23447 (Segfault when a class passed to SoapServer::setClass() fails to initialize)
--EXTENSIONS--
soap

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit adding proper CREDITS here

private $broken = undefinedConstant;
}

$server = new SoapServer(null, array('uri' => 'http://testuri.org'));

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: for arrays, the [] form is preferred.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants