[go: nahoru, domu]

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removed warning about missing namespace leading backslash in var_export() docs #1472

Closed
wants to merge 1 commit into from

Commits on Mar 21, 2022

  1. Removed warning about missing namespace leading backslash in `var_exp…

    …ort()` docs
    
    `var_export()` needs to prefix classes it references with `\`, because its code could be transplanted in
    any source location/namespace, so the assumption of it being used only in the context of the root
    namespace is not sufficient.
    
    For example, in a code snippet like following ( https://3v4l.org/4mONc ):
    
    ```php
    <?php
    
    class SomeObject {}
    var_export([new SomeObject]);
    ```
    
    This should produce:
    
    ```
    array (
      0 => 
      \SomeObject::__set_state(array(
      )),
    )
    ```
    
    Userland should not concern itself with the contents of the `var_export()`-produced code
    snippets, and use them as-is instead.
    
    Ref: php/php-src#8232
    Ref: php/php-src#8233
    Ref: Ocramius/ProxyManager#754
    Ocramius committed Mar 21, 2022
    Configuration menu
    Copy the full SHA
    6f0a58d View commit details
    Browse the repository at this point in the history