dmitry Fri Dec 8 15:55:31 2006 UTC
Added files: (Branch: PHP_5_2)
/ZendEngine2/tests bug39775.phpt
Modified files:
/php-src NEWS
/ZendEngine2 zend_execute.c zend_object_handlers.c
/ZendEngine2/tests bug38146.phpt
/php-src/ext/spl/tests iterator_035.phpt
/php-src/tests/classes array_access_003.phpt array_access_004.phpt
array_access_005.phpt array_access_008.phpt
array_access_012.phpt
Log:
Fixed bug #39775 ("Indirect modification ..." message is not shown)
The fix breaks two SimpleXML tests those must be fixed
http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.410&r2=1.2027.2.547.2.411&diff_format=u
Index: php-src/NEWS
diff -u php-src/NEWS:1.2027.2.547.2.410 php-src/NEWS:1.2027.2.547.2.411
--- php-src/NEWS:1.2027.2.547.2.410 Thu Dec 7 11:00:08 2006
+++ php-src/NEWS Fri Dec 8 15:55:30 2006
@@ -49,6 +49,7 @@
- Fixed FastCGI impersonation for persistent connections on Windows. (Dmitry)
- Fixed wrong signature initialization in imagepng (Takeshi Abe)
- Added optimization for imageline with horizontal and vertial lines (Pierre)
+- Fixed bug #39775 ("Indirect modification ..." message is not shown). (Dmitry)
- Fixed bug #39763 (magic quotes are applied twice by ext/filter). (Tony)
- Fixed bug #39754 (Some POSIX extension functions not thread safe).
(Ilia, wharmby at uk dot ibm dot com)
http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_execute.c?r1=1.716.2.12.2.13&r2=1.716.2.12.2.14&diff_format=u
Index: ZendEngine2/zend_execute.c
diff -u ZendEngine2/zend_execute.c:1.716.2.12.2.13
ZendEngine2/zend_execute.c:1.716.2.12.2.14
--- ZendEngine2/zend_execute.c:1.716.2.12.2.13 Tue Nov 7 20:23:30 2006
+++ ZendEngine2/zend_execute.c Fri Dec 8 15:55:30 2006
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: zend_execute.c,v 1.716.2.12.2.13 2006/11/07 20:23:30 iliaa Exp $ */
+/* $Id: zend_execute.c,v 1.716.2.12.2.14 2006/12/08 15:55:30 dmitry Exp $ */
#define ZEND_INTENSIVE_DEBUGGING 0
@@ -1162,16 +1162,21 @@
overloaded_result =
Z_OBJ_HT_P(container)->read_dimension(container, dim, type TSRMLS_CC);
if (overloaded_result) {
- switch (type) {
- case BP_VAR_RW:
- case BP_VAR_W:
- if
(Z_TYPE_P(overloaded_result) != IS_OBJECT
- &&
!overloaded_result->is_ref) {
-
zend_error_noreturn(E_ERROR, "Objects used as arrays in post/pre
increment/decrement must return values by reference");
- }
- break;
+ if (type == BP_VAR_W || type ==
BP_VAR_RW || type == BP_VAR_UNSET) {
+ if (overloaded_result->refcount
> 0) {
+ zval *tmp =
overloaded_result;
+
+
ALLOC_ZVAL(overloaded_result);
+ *overloaded_result =
*tmp;
+
zval_copy_ctor(overloaded_result);
+
overloaded_result->is_ref = 0;
+
overloaded_result->refcount = 0;
+ }
+ if (Z_TYPE_P(overloaded_result)
!= IS_OBJECT) {
+ zend_class_entry *ce =
Z_OBJCE_P(container);
+ zend_error(E_NOTICE,
"Indirect modification of overloaded element of %s has no effect", ce->name);
+ }
}
-
retval = &overloaded_result;
} else {
retval = &EG(error_zval_ptr);
http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_object_handlers.c?r1=1.135.2.6.2.16&r2=1.135.2.6.2.17&diff_format=u
Index: ZendEngine2/zend_object_handlers.c
diff -u ZendEngine2/zend_object_handlers.c:1.135.2.6.2.16
ZendEngine2/zend_object_handlers.c:1.135.2.6.2.17
--- ZendEngine2/zend_object_handlers.c:1.135.2.6.2.16 Wed Nov 8 13:38:28 2006
+++ ZendEngine2/zend_object_handlers.c Fri Dec 8 15:55:30 2006
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: zend_object_handlers.c,v 1.135.2.6.2.16 2006/11/08 13:38:28 dmitry Exp
$ */
+/* $Id: zend_object_handlers.c,v 1.135.2.6.2.17 2006/12/08 15:55:30 dmitry Exp
$ */
#include "zend.h"
#include "zend_globals.h"
@@ -334,14 +334,16 @@
if (rv) {
retval = &rv;
- if ((type == BP_VAR_W || type == BP_VAR_RW ||
type == BP_VAR_UNSET) && rv->refcount > 0) {
- zval *tmp = rv;
-
- ALLOC_ZVAL(rv);
- *rv = *tmp;
- zval_copy_ctor(rv);
- rv->is_ref = 0;
- rv->refcount = 0;
+ if (type == BP_VAR_W || type == BP_VAR_RW ||
type == BP_VAR_UNSET) {
+ if (rv->refcount > 0) {
+ zval *tmp = rv;
+
+ ALLOC_ZVAL(rv);
+ *rv = *tmp;
+ zval_copy_ctor(rv);
+ rv->is_ref = 0;
+ rv->refcount = 0;
+ }
if (Z_TYPE_P(rv) != IS_OBJECT) {
zend_error(E_NOTICE, "Indirect
modification of overloaded property %s::$%s has no effect", zobj->ce->name,
Z_STRVAL_P(member));
}
@@ -469,19 +471,6 @@
/* Undo PZVAL_LOCK() */
retval->refcount--;
- if ((type == BP_VAR_W || type == BP_VAR_RW || type ==
BP_VAR_UNSET) && retval->refcount > 0) {
- zval *tmp = retval;
-
- ALLOC_ZVAL(retval);
- *retval = *tmp;
- zval_copy_ctor(retval);
- retval->is_ref = 0;
- retval->refcount = 0;
- if (Z_TYPE_P(retval) != IS_OBJECT) {
- zend_error(E_NOTICE, "Indirect modification of
overloaded element of %s has no effect", ce->name);
- }
- }
-
return retval;
} else {
zend_error(E_ERROR, "Cannot use object of type %s as array",
ce->name);
http://cvs.php.net/viewvc.cgi/ZendEngine2/tests/bug38146.phpt?r1=1.1.2.1&r2=1.1.2.2&diff_format=u
Index: ZendEngine2/tests/bug38146.phpt
diff -u ZendEngine2/tests/bug38146.phpt:1.1.2.1
ZendEngine2/tests/bug38146.phpt:1.1.2.2
--- ZendEngine2/tests/bug38146.phpt:1.1.2.1 Mon Jul 24 07:43:49 2006
+++ ZendEngine2/tests/bug38146.phpt Fri Dec 8 15:55:30 2006
@@ -14,6 +14,7 @@
print "$key => $value\n";
}
?>
---EXPECT--
+--EXPECTF--
+Notice: Indirect modification of overloaded property foo::$bar has no effect
in %sbug38146.php on line 10
foo => bar
bar => foo
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/tests/iterator_035.phpt?r1=1.1.2.1.2.1&r2=1.1.2.1.2.2&diff_format=u
Index: php-src/ext/spl/tests/iterator_035.phpt
diff -u php-src/ext/spl/tests/iterator_035.phpt:1.1.2.1.2.1
php-src/ext/spl/tests/iterator_035.phpt:1.1.2.1.2.2
--- php-src/ext/spl/tests/iterator_035.phpt:1.1.2.1.2.1 Fri Oct 20 02:11:19 2006
+++ php-src/ext/spl/tests/iterator_035.phpt Fri Dec 8 15:55:31 2006
@@ -14,4 +14,6 @@
echo "Done\n";
?>
--EXPECTF--
+Notice: Indirect modification of overloaded element of ArrayIterator has no
effect in %siterator_035.php on line 7
+
Fatal error: Cannot assign by reference to overloaded object in %s on line %d
http://cvs.php.net/viewvc.cgi/php-src/tests/classes/array_access_003.phpt?r1=1.6&r2=1.6.4.1&diff_format=u
Index: php-src/tests/classes/array_access_003.phpt
diff -u php-src/tests/classes/array_access_003.phpt:1.6
php-src/tests/classes/array_access_003.phpt:1.6.4.1
--- php-src/tests/classes/array_access_003.phpt:1.6 Sun Jun 19 20:49:17 2005
+++ php-src/tests/classes/array_access_003.phpt Fri Dec 8 15:55:31 2006
@@ -53,4 +53,7 @@
int(1)
object::offsetGet(2)
-Fatal error: Objects used as arrays in post/pre increment/decrement must
return values by reference in %sarray_access_003.php on line %d
+Notice: Indirect modification of overloaded element of object has no effect in
%sarray_access_003.php on line 39
+object::offsetGet(2)
+int(1)
+===DONE===
http://cvs.php.net/viewvc.cgi/php-src/tests/classes/array_access_004.phpt?r1=1.3&r2=1.3.4.1&diff_format=u
Index: php-src/tests/classes/array_access_004.phpt
diff -u php-src/tests/classes/array_access_004.phpt:1.3
php-src/tests/classes/array_access_004.phpt:1.3.4.1
--- php-src/tests/classes/array_access_004.phpt:1.3 Wed Sep 29 09:36:56 2004
+++ php-src/tests/classes/array_access_004.phpt Fri Dec 8 15:55:31 2006
@@ -51,4 +51,7 @@
int(1)
object::offsetGet(2)
-Fatal error: Objects used as arrays in post/pre increment/decrement must
return values by reference in %sarray_access_004.php on line %d
+Notice: Indirect modification of overloaded element of object has no effect in
%sarray_access_004.php on line 39
+object::offsetGet(2)
+int(1)
+===DONE===
http://cvs.php.net/viewvc.cgi/php-src/tests/classes/array_access_005.phpt?r1=1.4.4.2&r2=1.4.4.3&diff_format=u
Index: php-src/tests/classes/array_access_005.phpt
diff -u php-src/tests/classes/array_access_005.phpt:1.4.4.2
php-src/tests/classes/array_access_005.phpt:1.4.4.3
--- php-src/tests/classes/array_access_005.phpt:1.4.4.2 Fri Nov 10 17:04:03 2006
+++ php-src/tests/classes/array_access_005.phpt Fri Dec 8 15:55:31 2006
@@ -70,5 +70,8 @@
}
Notice: Indirect modification of overloaded element of Peoples has no effect
in %sarray_access_005.php on line 46
+string(6) "JoeFoo"
-Fatal error: Objects used as arrays in post/pre increment/decrement must
return values by reference in %sarray_access_005.php on line %d
+Notice: Indirect modification of overloaded element of Peoples has no effect
in %sarray_access_005.php on line 48
+string(6) "JoeFoo"
+===DONE===
http://cvs.php.net/viewvc.cgi/php-src/tests/classes/array_access_008.phpt?r1=1.2.4.2&r2=1.2.4.3&diff_format=u
Index: php-src/tests/classes/array_access_008.phpt
diff -u php-src/tests/classes/array_access_008.phpt:1.2.4.2
php-src/tests/classes/array_access_008.phpt:1.2.4.3
--- php-src/tests/classes/array_access_008.phpt:1.2.4.2 Fri Nov 10 17:04:03 2006
+++ php-src/tests/classes/array_access_008.phpt Fri Dec 8 15:55:31 2006
@@ -57,5 +57,11 @@
string(3) "Foo"
Notice: Indirect modification of overloaded element of Peoples has no effect
in %sarray_access_008.php on line 40
+string(3) "Foo"
-Fatal error: Objects used as arrays in post/pre increment/decrement must
return values by reference in %sarray_access_008.php on line %d
+Notice: Indirect modification of overloaded element of Peoples has no effect
in %sarray_access_008.php on line 42
+string(3) "Foo"
+
+Notice: Indirect modification of overloaded element of Peoples has no effect
in %sarray_access_008.php on line 44
+string(3) "Foo"
+===DONE===
http://cvs.php.net/viewvc.cgi/php-src/tests/classes/array_access_012.phpt?r1=1.1.4.2&r2=1.1.4.3&diff_format=u
Index: php-src/tests/classes/array_access_012.phpt
diff -u php-src/tests/classes/array_access_012.phpt:1.1.4.2
php-src/tests/classes/array_access_012.phpt:1.1.4.3
--- php-src/tests/classes/array_access_012.phpt:1.1.4.2 Fri Nov 10 17:04:03 2006
+++ php-src/tests/classes/array_access_012.phpt Fri Dec 8 15:55:31 2006
@@ -33,4 +33,4 @@
Notice: Indirect modification of overloaded element of ArrayAccessImpl has no
effect in %sarray_access_012.php on line 24
-Fatal error: Objects used as arrays in post/pre increment/decrement must
return values by reference in %sarray_access_012.php on line %d
+Fatal error: Cannot assign by reference to overloaded object in
%sarray_access_012.php on line 24
http://cvs.php.net/viewvc.cgi/ZendEngine2/tests/bug39775.phpt?view=markup&rev=1.1
Index: ZendEngine2/tests/bug39775.phpt
+++ ZendEngine2/tests/bug39775.phpt
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php