All pastes #1429748 Raw Edit

rewbs

public diff v1 · immutable
#1429748 ·published 2009-05-21 09:51 UTC
rendered paste body
Index: ext/spl/spl_array.c===================================================================RCS file: /repository/php-src/ext/spl/spl_array.c,vretrieving revision 1.71.2.17.2.13.2.39diff -u -w -p -r1.71.2.17.2.13.2.39 spl_array.c--- ext/spl/spl_array.c	19 Mar 2009 03:01:37 -0000	1.71.2.17.2.13.2.39+++ ext/spl/spl_array.c	20 May 2009 19:43:25 -0000@@ -745,12 +745,12 @@ static int spl_array_has_property(zval * { 	spl_array_object *intern = (spl_array_object*)zend_object_store_get_object(object TSRMLS_CC); -	if (std_object_handlers.has_property(object, member, has_set_exists TSRMLS_CC)) {-		return 1;-	} else if ((intern->ar_flags & SPL_ARRAY_ARRAY_AS_PROPS) != 0) {+	if ((intern->ar_flags & SPL_ARRAY_ARRAY_AS_PROPS) != 0+	&& !std_object_handlers.has_property(object, member, 2 TSRMLS_CC)) { 		return spl_array_has_dimension(object, member, has_set_exists TSRMLS_CC); 	}-	return 0;+	return std_object_handlers.has_property(object, member, has_set_exists TSRMLS_CC);+ } /* }}} */  static void spl_array_unset_property(zval *object, zval *member TSRMLS_DC) /* {{{ */Index: ext/spl/tests/arrayObject_magicMethods6.phpt===================================================================RCS file: /repository/php-src/ext/spl/tests/arrayObject_magicMethods6.phpt,vretrieving revision 1.1.4.2diff -u -w -p -r1.1.4.2 arrayObject_magicMethods6.phpt--- ext/spl/tests/arrayObject_magicMethods6.phpt	17 Oct 2008 14:34:55 -0000	1.1.4.2+++ ext/spl/tests/arrayObject_magicMethods6.phpt	21 May 2009 09:12:37 -0000@@ -143,11 +143,8 @@ object(UsesMagic)#2 (2) { }  --> isset existent, non-existent and dynamic:-In UsesMagic::__isset(a) bool(true)-In UsesMagic::__isset(nonexistent) bool(false)-In UsesMagic::__isset(dynamic) bool(true)   Original wrapped object: object(C)#1 (5) {Index: ext/spl/tests/bug45622b.phpt===================================================================RCS file: ext/spl/tests/bug45622b.phptdiff -N ext/spl/tests/bug45622b.phpt--- /dev/null	1 Jan 1970 00:00:00 -0000+++ ext/spl/tests/bug45622b.phpt	21 May 2009 09:14:23 -0000@@ -0,0 +1,33 @@+--TEST--+Ensure fix to bug45622 doesn't cause __isset() to be called when ArrayObject::ARRAY_AS_PROPS is used.+--FILE--+<?php+class UsesMagic extends ArrayObject {+	function __get($n)     {  echo "In " . __METHOD__ . "!\n"; }+	function __set($n, $v) {  echo "In " . __METHOD__ . "!\n"; }+	function __isset($n)   {  echo "In " . __METHOD__ . "!\n"; }+	function __unset($n)   {  echo "In " . __METHOD__ . "!\n"; }+}+$ao = new UsesMagic(array(), ArrayObject::ARRAY_AS_PROPS);++echo "Doesn't trigger __get.\n";+echo $ao->prop1;++echo "Doesn't trigger __set.\n";    +$ao->prop2 = 'foo';++echo "Doesn't trigger __unset.\n";+unset($ao->prop3);++echo "Shouldn't trigger __isset.\n";+isset($ao->prop4);+?>+--EXPECTF--+Doesn't trigger __get.++Notice: Undefined index:  prop1 in %s on line 11+Doesn't trigger __set.+Doesn't trigger __unset.++Notice: Undefined index:  prop3 in %s on line 17+Shouldn't trigger __isset.\ No newline at end of file