dmitry                                   Mon, 01 Aug 2011 15:23:16 +0000

Revision: http://svn.php.net/viewvc?view=revision&revision=314054

Log:
Fixed bug #55305 (ref lost: 1st ref instantiated in class def, 2nd ref made w/o 
instantiating)

Bug: https://bugs.php.net/55305 (Verified) ref lost: 1st ref instantiated in 
class def, 2nd ref made w/o instantiating
      
Changed paths:
    A   php/php-src/branches/PHP_5_4/Zend/tests/bug55305.phpt
    U   php/php-src/branches/PHP_5_4/Zend/zend_vm_def.h
    U   php/php-src/branches/PHP_5_4/Zend/zend_vm_execute.h
    A   php/php-src/trunk/Zend/tests/bug55305.phpt
    U   php/php-src/trunk/Zend/zend_vm_def.h
    U   php/php-src/trunk/Zend/zend_vm_execute.h

Added: php/php-src/branches/PHP_5_4/Zend/tests/bug55305.phpt
===================================================================
--- php/php-src/branches/PHP_5_4/Zend/tests/bug55305.phpt	                        (rev 0)
+++ php/php-src/branches/PHP_5_4/Zend/tests/bug55305.phpt	2011-08-01 15:23:16 UTC (rev 314054)
@@ -0,0 +1,16 @@
+--TEST--
+Bug #55305 (ref lost: 1st ref instantiated in class def, 2nd ref made w/o instantiating)
+--FILE--
+<?php
+class Foo {
+  var $foo = "test";
+}
+
+$f = new Foo();
+$f->bar =& $f->foo;
+var_dump($f->foo);
+var_dump($f->bar);
+?>
+--EXPECT--
+string(4) "test"
+string(4) "test"

Modified: php/php-src/branches/PHP_5_4/Zend/zend_vm_def.h
===================================================================
--- php/php-src/branches/PHP_5_4/Zend/zend_vm_def.h	2011-08-01 15:16:50 UTC (rev 314053)
+++ php/php-src/branches/PHP_5_4/Zend/zend_vm_def.h	2011-08-01 15:23:16 UTC (rev 314054)
@@ -1417,6 +1417,8 @@
 		Z_DELREF_PP(retval_ptr);
 		SEPARATE_ZVAL_TO_MAKE_IS_REF(retval_ptr);
 		Z_ADDREF_PP(retval_ptr);
+		EX_T(opline->result.var).var.ptr = *EX_T(opline->result.var).var.ptr_ptr;
+		EX_T(opline->result.var).var.ptr_ptr = &EX_T(opline->result.var).var.ptr;
 	}

 	CHECK_EXCEPTION();

Modified: php/php-src/branches/PHP_5_4/Zend/zend_vm_execute.h
===================================================================
--- php/php-src/branches/PHP_5_4/Zend/zend_vm_execute.h	2011-08-01 15:16:50 UTC (rev 314053)
+++ php/php-src/branches/PHP_5_4/Zend/zend_vm_execute.h	2011-08-01 15:23:16 UTC (rev 314054)
@@ -12736,6 +12736,8 @@
 		Z_DELREF_PP(retval_ptr);
 		SEPARATE_ZVAL_TO_MAKE_IS_REF(retval_ptr);
 		Z_ADDREF_PP(retval_ptr);
+		EX_T(opline->result.var).var.ptr = *EX_T(opline->result.var).var.ptr_ptr;
+		EX_T(opline->result.var).var.ptr_ptr = &EX_T(opline->result.var).var.ptr;
 	}

 	CHECK_EXCEPTION();
@@ -14875,6 +14877,8 @@
 		Z_DELREF_PP(retval_ptr);
 		SEPARATE_ZVAL_TO_MAKE_IS_REF(retval_ptr);
 		Z_ADDREF_PP(retval_ptr);
+		EX_T(opline->result.var).var.ptr = *EX_T(opline->result.var).var.ptr_ptr;
+		EX_T(opline->result.var).var.ptr_ptr = &EX_T(opline->result.var).var.ptr;
 	}

 	CHECK_EXCEPTION();
@@ -16935,6 +16939,8 @@
 		Z_DELREF_PP(retval_ptr);
 		SEPARATE_ZVAL_TO_MAKE_IS_REF(retval_ptr);
 		Z_ADDREF_PP(retval_ptr);
+		EX_T(opline->result.var).var.ptr = *EX_T(opline->result.var).var.ptr_ptr;
+		EX_T(opline->result.var).var.ptr_ptr = &EX_T(opline->result.var).var.ptr;
 	}

 	CHECK_EXCEPTION();
@@ -19999,6 +20005,8 @@
 		Z_DELREF_PP(retval_ptr);
 		SEPARATE_ZVAL_TO_MAKE_IS_REF(retval_ptr);
 		Z_ADDREF_PP(retval_ptr);
+		EX_T(opline->result.var).var.ptr = *EX_T(opline->result.var).var.ptr_ptr;
+		EX_T(opline->result.var).var.ptr_ptr = &EX_T(opline->result.var).var.ptr;
 	}

 	CHECK_EXCEPTION();
@@ -21596,6 +21604,8 @@
 		Z_DELREF_PP(retval_ptr);
 		SEPARATE_ZVAL_TO_MAKE_IS_REF(retval_ptr);
 		Z_ADDREF_PP(retval_ptr);
+		EX_T(opline->result.var).var.ptr = *EX_T(opline->result.var).var.ptr_ptr;
+		EX_T(opline->result.var).var.ptr_ptr = &EX_T(opline->result.var).var.ptr;
 	}

 	CHECK_EXCEPTION();
@@ -22835,6 +22845,8 @@
 		Z_DELREF_PP(retval_ptr);
 		SEPARATE_ZVAL_TO_MAKE_IS_REF(retval_ptr);
 		Z_ADDREF_PP(retval_ptr);
+		EX_T(opline->result.var).var.ptr = *EX_T(opline->result.var).var.ptr_ptr;
+		EX_T(opline->result.var).var.ptr_ptr = &EX_T(opline->result.var).var.ptr;
 	}

 	CHECK_EXCEPTION();
@@ -23983,6 +23995,8 @@
 		Z_DELREF_PP(retval_ptr);
 		SEPARATE_ZVAL_TO_MAKE_IS_REF(retval_ptr);
 		Z_ADDREF_PP(retval_ptr);
+		EX_T(opline->result.var).var.ptr = *EX_T(opline->result.var).var.ptr_ptr;
+		EX_T(opline->result.var).var.ptr_ptr = &EX_T(opline->result.var).var.ptr;
 	}

 	CHECK_EXCEPTION();
@@ -25399,6 +25413,8 @@
 		Z_DELREF_PP(retval_ptr);
 		SEPARATE_ZVAL_TO_MAKE_IS_REF(retval_ptr);
 		Z_ADDREF_PP(retval_ptr);
+		EX_T(opline->result.var).var.ptr = *EX_T(opline->result.var).var.ptr_ptr;
+		EX_T(opline->result.var).var.ptr_ptr = &EX_T(opline->result.var).var.ptr;
 	}

 	CHECK_EXCEPTION();
@@ -28303,6 +28319,8 @@
 		Z_DELREF_PP(retval_ptr);
 		SEPARATE_ZVAL_TO_MAKE_IS_REF(retval_ptr);
 		Z_ADDREF_PP(retval_ptr);
+		EX_T(opline->result.var).var.ptr = *EX_T(opline->result.var).var.ptr_ptr;
+		EX_T(opline->result.var).var.ptr_ptr = &EX_T(opline->result.var).var.ptr;
 	}

 	CHECK_EXCEPTION();
@@ -30225,6 +30243,8 @@
 		Z_DELREF_PP(retval_ptr);
 		SEPARATE_ZVAL_TO_MAKE_IS_REF(retval_ptr);
 		Z_ADDREF_PP(retval_ptr);
+		EX_T(opline->result.var).var.ptr = *EX_T(opline->result.var).var.ptr_ptr;
+		EX_T(opline->result.var).var.ptr_ptr = &EX_T(opline->result.var).var.ptr;
 	}

 	CHECK_EXCEPTION();
@@ -32159,6 +32179,8 @@
 		Z_DELREF_PP(retval_ptr);
 		SEPARATE_ZVAL_TO_MAKE_IS_REF(retval_ptr);
 		Z_ADDREF_PP(retval_ptr);
+		EX_T(opline->result.var).var.ptr = *EX_T(opline->result.var).var.ptr_ptr;
+		EX_T(opline->result.var).var.ptr_ptr = &EX_T(opline->result.var).var.ptr;
 	}

 	CHECK_EXCEPTION();
@@ -34960,6 +34982,8 @@
 		Z_DELREF_PP(retval_ptr);
 		SEPARATE_ZVAL_TO_MAKE_IS_REF(retval_ptr);
 		Z_ADDREF_PP(retval_ptr);
+		EX_T(opline->result.var).var.ptr = *EX_T(opline->result.var).var.ptr_ptr;
+		EX_T(opline->result.var).var.ptr_ptr = &EX_T(opline->result.var).var.ptr;
 	}

 	CHECK_EXCEPTION();

Added: php/php-src/trunk/Zend/tests/bug55305.phpt
===================================================================
--- php/php-src/trunk/Zend/tests/bug55305.phpt	                        (rev 0)
+++ php/php-src/trunk/Zend/tests/bug55305.phpt	2011-08-01 15:23:16 UTC (rev 314054)
@@ -0,0 +1,16 @@
+--TEST--
+Bug #55305 (ref lost: 1st ref instantiated in class def, 2nd ref made w/o instantiating)
+--FILE--
+<?php
+class Foo {
+  var $foo = "test";
+}
+
+$f = new Foo();
+$f->bar =& $f->foo;
+var_dump($f->foo);
+var_dump($f->bar);
+?>
+--EXPECT--
+string(4) "test"
+string(4) "test"

Modified: php/php-src/trunk/Zend/zend_vm_def.h
===================================================================
--- php/php-src/trunk/Zend/zend_vm_def.h	2011-08-01 15:16:50 UTC (rev 314053)
+++ php/php-src/trunk/Zend/zend_vm_def.h	2011-08-01 15:23:16 UTC (rev 314054)
@@ -1417,6 +1417,8 @@
 		Z_DELREF_PP(retval_ptr);
 		SEPARATE_ZVAL_TO_MAKE_IS_REF(retval_ptr);
 		Z_ADDREF_PP(retval_ptr);
+		EX_T(opline->result.var).var.ptr = *EX_T(opline->result.var).var.ptr_ptr;
+		EX_T(opline->result.var).var.ptr_ptr = &EX_T(opline->result.var).var.ptr;
 	}

 	CHECK_EXCEPTION();

Modified: php/php-src/trunk/Zend/zend_vm_execute.h
===================================================================
--- php/php-src/trunk/Zend/zend_vm_execute.h	2011-08-01 15:16:50 UTC (rev 314053)
+++ php/php-src/trunk/Zend/zend_vm_execute.h	2011-08-01 15:23:16 UTC (rev 314054)
@@ -12736,6 +12736,8 @@
 		Z_DELREF_PP(retval_ptr);
 		SEPARATE_ZVAL_TO_MAKE_IS_REF(retval_ptr);
 		Z_ADDREF_PP(retval_ptr);
+		EX_T(opline->result.var).var.ptr = *EX_T(opline->result.var).var.ptr_ptr;
+		EX_T(opline->result.var).var.ptr_ptr = &EX_T(opline->result.var).var.ptr;
 	}

 	CHECK_EXCEPTION();
@@ -14875,6 +14877,8 @@
 		Z_DELREF_PP(retval_ptr);
 		SEPARATE_ZVAL_TO_MAKE_IS_REF(retval_ptr);
 		Z_ADDREF_PP(retval_ptr);
+		EX_T(opline->result.var).var.ptr = *EX_T(opline->result.var).var.ptr_ptr;
+		EX_T(opline->result.var).var.ptr_ptr = &EX_T(opline->result.var).var.ptr;
 	}

 	CHECK_EXCEPTION();
@@ -16935,6 +16939,8 @@
 		Z_DELREF_PP(retval_ptr);
 		SEPARATE_ZVAL_TO_MAKE_IS_REF(retval_ptr);
 		Z_ADDREF_PP(retval_ptr);
+		EX_T(opline->result.var).var.ptr = *EX_T(opline->result.var).var.ptr_ptr;
+		EX_T(opline->result.var).var.ptr_ptr = &EX_T(opline->result.var).var.ptr;
 	}

 	CHECK_EXCEPTION();
@@ -19999,6 +20005,8 @@
 		Z_DELREF_PP(retval_ptr);
 		SEPARATE_ZVAL_TO_MAKE_IS_REF(retval_ptr);
 		Z_ADDREF_PP(retval_ptr);
+		EX_T(opline->result.var).var.ptr = *EX_T(opline->result.var).var.ptr_ptr;
+		EX_T(opline->result.var).var.ptr_ptr = &EX_T(opline->result.var).var.ptr;
 	}

 	CHECK_EXCEPTION();
@@ -21596,6 +21604,8 @@
 		Z_DELREF_PP(retval_ptr);
 		SEPARATE_ZVAL_TO_MAKE_IS_REF(retval_ptr);
 		Z_ADDREF_PP(retval_ptr);
+		EX_T(opline->result.var).var.ptr = *EX_T(opline->result.var).var.ptr_ptr;
+		EX_T(opline->result.var).var.ptr_ptr = &EX_T(opline->result.var).var.ptr;
 	}

 	CHECK_EXCEPTION();
@@ -22835,6 +22845,8 @@
 		Z_DELREF_PP(retval_ptr);
 		SEPARATE_ZVAL_TO_MAKE_IS_REF(retval_ptr);
 		Z_ADDREF_PP(retval_ptr);
+		EX_T(opline->result.var).var.ptr = *EX_T(opline->result.var).var.ptr_ptr;
+		EX_T(opline->result.var).var.ptr_ptr = &EX_T(opline->result.var).var.ptr;
 	}

 	CHECK_EXCEPTION();
@@ -23983,6 +23995,8 @@
 		Z_DELREF_PP(retval_ptr);
 		SEPARATE_ZVAL_TO_MAKE_IS_REF(retval_ptr);
 		Z_ADDREF_PP(retval_ptr);
+		EX_T(opline->result.var).var.ptr = *EX_T(opline->result.var).var.ptr_ptr;
+		EX_T(opline->result.var).var.ptr_ptr = &EX_T(opline->result.var).var.ptr;
 	}

 	CHECK_EXCEPTION();
@@ -25399,6 +25413,8 @@
 		Z_DELREF_PP(retval_ptr);
 		SEPARATE_ZVAL_TO_MAKE_IS_REF(retval_ptr);
 		Z_ADDREF_PP(retval_ptr);
+		EX_T(opline->result.var).var.ptr = *EX_T(opline->result.var).var.ptr_ptr;
+		EX_T(opline->result.var).var.ptr_ptr = &EX_T(opline->result.var).var.ptr;
 	}

 	CHECK_EXCEPTION();
@@ -28303,6 +28319,8 @@
 		Z_DELREF_PP(retval_ptr);
 		SEPARATE_ZVAL_TO_MAKE_IS_REF(retval_ptr);
 		Z_ADDREF_PP(retval_ptr);
+		EX_T(opline->result.var).var.ptr = *EX_T(opline->result.var).var.ptr_ptr;
+		EX_T(opline->result.var).var.ptr_ptr = &EX_T(opline->result.var).var.ptr;
 	}

 	CHECK_EXCEPTION();
@@ -30225,6 +30243,8 @@
 		Z_DELREF_PP(retval_ptr);
 		SEPARATE_ZVAL_TO_MAKE_IS_REF(retval_ptr);
 		Z_ADDREF_PP(retval_ptr);
+		EX_T(opline->result.var).var.ptr = *EX_T(opline->result.var).var.ptr_ptr;
+		EX_T(opline->result.var).var.ptr_ptr = &EX_T(opline->result.var).var.ptr;
 	}

 	CHECK_EXCEPTION();
@@ -32159,6 +32179,8 @@
 		Z_DELREF_PP(retval_ptr);
 		SEPARATE_ZVAL_TO_MAKE_IS_REF(retval_ptr);
 		Z_ADDREF_PP(retval_ptr);
+		EX_T(opline->result.var).var.ptr = *EX_T(opline->result.var).var.ptr_ptr;
+		EX_T(opline->result.var).var.ptr_ptr = &EX_T(opline->result.var).var.ptr;
 	}

 	CHECK_EXCEPTION();
@@ -34960,6 +34982,8 @@
 		Z_DELREF_PP(retval_ptr);
 		SEPARATE_ZVAL_TO_MAKE_IS_REF(retval_ptr);
 		Z_ADDREF_PP(retval_ptr);
+		EX_T(opline->result.var).var.ptr = *EX_T(opline->result.var).var.ptr_ptr;
+		EX_T(opline->result.var).var.ptr_ptr = &EX_T(opline->result.var).var.ptr;
 	}

 	CHECK_EXCEPTION();
-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to