Re: array_key_exists BC break

From: Date: Fri, 24 Oct 2008 17:05:48 +0000
Subject: Re: array_key_exists BC break
References: 1 2 3 4 5  Groups: php.internals 
Request: Send a blank email to internals+get-41369@lists.php.net to get a copy of this message
Hi!
nope that would mean that some scripts might work different between 5.2 and 5.3, now one gets an error. consider such a script:
Just so it is clear - some scripts ALREADY work differently, that's why it says "BC break".
<?php class Foo extends ArrayAccess {
    public $prop = 42;
    function offsetGet($n) { ... }
    ....
} $o = new foo; array_key_Exists('prop', $o); ?> In <= 5.2 it will return the value of $o->prop, in 5.3 it would call the offsetGet() method.
In 5.2 it would return true and not the value of $o->prop. In 5.3 I don't think it would call offsetGet. It would call get_properties method of ArrayAccess, and that should return list of object's properties as array, so in this case the return will still be true. -- Stanislav Malyshev, Zend Software Architect stas@zend.com http://www.zend.com/ (408)253-8829 MSN: stas@zend.com

« previous php.internals (#41369) next »