[php-src] PR #25831: Fix SOAP error handler dropping a custom HTTP status line
| From: | lacatoire | Date: | Fri, 27 Nov 2026 11:07:30 +0000 |
| Subject: | [php-src] PR #25831: Fix SOAP error handler dropping a custom HTTP status line | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-41107@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/25831
Author: lacatoire
While the SOAP error handler is active, a non-fatal diagnostic drops a custom HTTP status line set
with
header(): the line is set to NULL before the previous error handler
is called and only restored in the zend_catch block, which runs when that handler bails
out. The client gets the default reason phrase and the custom line is leaked. It is now also
restored when the handler returns.
### To reproduce
Run under php -S:
```php
<?php
header('HTTP/1.1 404 Custom Reason');
use_soap_error_handler(true);
echo $undefinedVar;
echo "plain";
```
Before: HTTP/1.1 404 Not Found
After: HTTP/1.1 404 Custom Reason, as with the handler off.