Re: Merge PR 621

From: Date: Tue, 25 Mar 2014 03:34:01 +0000
Subject: Re: Merge PR 621
References: 1 2 3 4 5 6 7 8 9 10 11 12  Groups: php.internals 
Request: Send a blank email to [email protected] to get a copy of this message
Hi!

> Do you have any issues with the code as it stands now?
> 
> https://github.com/php/php-src/pull/614

Something I don't understand in this patch: so if we don't have "has"
override, we'd get value == NULL and then we go and check internal
hashtable. Shouldn't we first check the get override and ask it with
BP_VAR_IS, and only if get override is not there use direct hash access?

E.g. imagine this:

class SecretArrayObject extends ArrayObject
{
 	public function offsetGet($offset) {
 		var_dump('Called: '.__METHOD__);
 		return parent::offsetGet(str_rot13($offset));
 	}
 	public function offsetSet($offset) {
 		var_dump('Called: '.__METHOD__);
 		return parent::offsetSet(str_rot13($offset));
 	}
}

I think on this example your code may fail to go to correct items when
doing isset/isempty, since if I ask for 'qux' it would actually check
the value I've put there for 'dhk'.
-- 
Stanislav Malyshev, Software Architect
SugarCRM: http://www.sugarcrm.com/
(408)454-6900 ext. 227


Thread (23 messages)

« previous php.internals (#73408) next »