mirror of
https://github.com/php/php-src.git
synced 2025-08-16 14:08:47 +02:00
![]() Closes GH-8233 This fix corrects a behavior of `var_export()` that was mostly "hidden" until PHP 8.1 introduced: * properties with object initializers * constants containing object references * default values of class properties containing `enum`s Since `var_export(..., true)` is mostly used in conjunction with code generation, and we cannot make assumptions about the generated code being placed in the root namespace, we must always provide the FQCN of a class in exported code. For example: ```php <?php namespace MyNamespace { class Foo {} } namespace { echo "<?php\n\nnamespace Example;\n\n" . var_export(new \MyNamespace\Foo(), true) . ';'; } ``` produces: ```php <?php namespace Example; MyNamespace\Foo::__set_state(array( )); ``` This code snippet is invalid, because `Example\MyNamespace\Foo::__set_state()` (which does not exist) is called. With this patch applied, the code looks like following (valid): ```php <?php namespace Example; \MyNamespace\Foo::__set_state(array( )); ``` Ref: https://github.com/php/php-src/issues/8232 Ref: https://github.com/Ocramius/ProxyManager/issues/754 Ref: https://externals.io/message/117466 |
||
---|---|---|
.. | ||
argument_count_correct.phpt | ||
argument_count_correct_strict.phpt | ||
argument_count_incorrect_internal.phpt | ||
argument_count_incorrect_internal_strict.phpt | ||
argument_count_incorrect_userland.phpt | ||
argument_count_incorrect_userland_strict.phpt | ||
call_with_leading_comma_error.phpt | ||
call_with_multi_inner_comma_error.phpt | ||
call_with_multi_trailing_comma_error.phpt | ||
call_with_only_comma_error.phpt | ||
call_with_trailing_comma_basic.phpt | ||
sensitive_parameter.phpt | ||
sensitive_parameter_arrow_function.phpt | ||
sensitive_parameter_closure.phpt | ||
sensitive_parameter_correctly_captures_original.phpt | ||
sensitive_parameter_eval_call.phpt | ||
sensitive_parameter_eval_define.phpt | ||
sensitive_parameter_extra_arguments.phpt | ||
sensitive_parameter_multiple_arguments.phpt | ||
sensitive_parameter_named_arguments.phpt | ||
sensitive_parameter_nested_calls.phpt | ||
sensitive_parameter_value.phpt | ||
sensitive_parameter_value_clone.phpt | ||
sensitive_parameter_value_keeps_object_alive.phpt | ||
sensitive_parameter_value_no_dynamic_property.phpt | ||
sensitive_parameter_value_reflection.phpt | ||
sensitive_parameter_value_serialize.phpt | ||
sensitive_parameter_value_to_string.phpt | ||
sensitive_parameter_variadic_arguments.phpt | ||
variadic_argument_type_error.phpt |