[php-src] Issue #10233: var_export inconsistent leading backslash behavior on version 8.2
| From: | sbarex | Date: | Thu, 05 Jan 2023 13:54:10 +0000 |
| Subject: | [php-src] Issue #10233: var_export inconsistent leading backslash behavior on version 8.2 | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-243347@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/10233
Author: sbarex
### Description
The official documentation says:
> **When var_export() exports objects, the leading backslash is not included in the class name of
> namespaced classes for maximum compatibility.**
This is correct until PHP 8.1.13. With PHP 8.2.0 the leading backslash **is included**.
The following code:
```php
<?php
namespace Test1;
class MyClass {
}
$test = new MyClass();
echo var_export($test, true);
```
Resulted in this output:
```php
\Test1\MyClass::__set_state(array(
))
```
But I expected this output instead:
```php
Test1\MyClass::__set_state(array(
))
```
### PHP Version
PHP 8.2.0
### Operating System
MacOS 13.1 intel