]> granicus.if.org Git - php/commitdiff
- Fixed bug #48248 (SIGSEGV when access to private property via &__get)
authorFelipe Pena <felipe@php.net>
Tue, 12 May 2009 22:50:56 +0000 (22:50 +0000)
committerFelipe Pena <felipe@php.net>
Tue, 12 May 2009 22:50:56 +0000 (22:50 +0000)
Zend/tests/bug48248.phpt [new file with mode: 0644]
Zend/zend_object_handlers.c

diff --git a/Zend/tests/bug48248.phpt b/Zend/tests/bug48248.phpt
new file mode 100644 (file)
index 0000000..9cdb7c1
--- /dev/null
@@ -0,0 +1,27 @@
+--TEST--
+Bug #48248 (SIGSEGV when access to private property via &__get)
+--FILE--
+<?php
+
+class A
+{
+    public function & __get($name)
+    {
+        return $this->test;
+    }
+}
+
+class B extends A
+{
+    private $test;
+}
+
+$b = new B;
+var_dump($b->test);
+
+?>
+--EXPECTF--
+Notice: Undefined property: B::$test in %s on line %d
+
+Notice: Only variable references should be returned by reference in %s on line %d
+NULL
index 82b308b47239b8a791f6b4562ca98174df6b0051..6564e050a18168b6b080b6fcce4eca768e8ca8f8 100644 (file)
@@ -583,8 +583,8 @@ static zval **zend_std_get_property_ptr_ptr(zval *object, zval *member TSRMLS_DC
                zend_guard *guard;
 
                if (!zobj->ce->__get ||
-                   zend_get_property_guard(zobj, property_info, member, &guard TSRMLS_CC) != SUCCESS ||
-                   guard->in_get) {
+                       zend_get_property_guard(zobj, property_info, member, &guard TSRMLS_CC) != SUCCESS ||
+                       (property_info && guard->in_get)) {
                        /* we don't have access controls - will just add it */
                        new_zval = &EG(uninitialized_zval);