Skip to content

Regression/unset properties behavior #228

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

Closed

Conversation

Ocramius
Copy link
Contributor

@Ocramius Ocramius commented Nov 8, 2012

This PR introduces a test to avoid regression on a functionality used to implement lazy loading in doctrine/common#168.

The concept is quite simple:

class A 
{
    public $b;
    public function __get($name)
    {
        echo 'called';
    }
}

$a = new A();
unset ($a->b);
$a->b; // produces output 'called'

This functionality initially looked like a bug to me, but it turned out to be expected behaviour after asking around for quite a bit. The PR introduces a test to protect this functionality.

…c properties

Verifies that after having unset a public property, any access to it, be it read or write, causes calls to public magic methods

Signed-off-by: Marco Pivetta <ocramius@gmail.com>
@lstrojny
Copy link
Contributor

lstrojny commented Dec 2, 2012

Merged into 5.4, 5.5, master. Thanks!

@php-pulls
Copy link

Comment on behalf of lstrojny at php.net:

Merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants