[php-src] Issue #19524: Inconsistent result invalid class with or without loop
| From: | YuanchengJiang | Date: | Wed, 20 Aug 2025 07:14:56 +0000 |
| Subject: | [php-src] Issue #19524: Inconsistent result invalid class with or without loop | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-250581@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/19524
Author: YuanchengJiang
### Description
The following code:
```php
<?php
$HTTP_RAW_POST_DATA = <<<EOF
<?xml version='1.0'
<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope">
<env:Header>
<test:validateCountryCode xmlns:test="http://example.org/ts-tests"
env:role="http://example.org/ts-tests/C"
env:mustUnderstand="1">ABCD</test:validateCountryCode>
</env:Header>
<env:Body>
</env:Body>
</env:Envelope>
EOF;
include "soap12-test.inc";
class Dummy extends Xmlparser {
}
var_dump(get_defined_vars());
```
Resulted in this output:
```
Fatal error: Class Dummy cannot extend final class XMLParser in /tmp/test.php on line 15
Stack trace:
#0 {main}
```
The following code:
```php
<?php
for ($i = 0; $i < 1; $i++) {
$HTTP_RAW_POST_DATA = <<<EOF
<?xml version='1.0'
<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope">
<env:Header>
<test:validateCountryCode xmlns:test="http://example.org/ts-tests"
env:role="http://example.org/ts-tests/C"
env:mustUnderstand="1">ABCD</test:validateCountryCode>
</env:Header>
<env:Body>
</env:Body>
</env:Envelope>
EOF;
include "soap12-test.inc";
class Dummy extends Xmlparser {
}
var_dump(get_defined_vars());
}
```
Resulted in this output:
```
<?xml version="1.0" encoding="UTF-8"?>
<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"><env:Body><env:Fault><env:Code><env:Value>env:Sender</env:Value></env:Code><env:Reason><env:Text
xml:lang="en">Bad
Request</env:Text></env:Reason></env:Fault></env:Body></env:Envelope>
```
### PHP Version
```plain
nightly
```
### Operating System
_No response_