Regression/unset properties behavior #228

Closed
wants to merge 3 commits into
from

Projects

None yet

3 participants

@Ocramius
Contributor
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.

Ocramius added some commits Oct 26, 2012
@Ocramius Ocramius Adding regression test for behavior of magic methods with unset publi…
…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>
af96e53
@Ocramius Ocramius Fixing test according to @jpauli's suggestions a594587
@Ocramius Ocramius Adding tests for private and protected properties e757645
@Ocramius Ocramius referenced this pull request in doctrine/common Nov 8, 2012
Merged

[DCOM-96] ProxyFactory logic moved to doctrine common #168

@lstrojny
Contributor
lstrojny commented Dec 2, 2012

Merged into 5.4, 5.5, master. Thanks!

@php-pulls

Comment on behalf of lstrojny at php.net:

Merged.

@php-pulls php-pulls closed this Dec 2, 2012
@Ocramius Ocramius deleted the Ocramius:regression/unset-properties-behavior branch Jan 15, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment