cvs: ZendEngine2(PHP_5_2) / zend_object_handlers.c /tests bug48248.phpt php-src NEWS

[email protected] ("Felipe Pena") Tue, 12 May 2009 23:01:38 -0000
Newsgroups php.zend-engine.cvs
Message-ID <cvsfelipe1242169298@cvsserver>
felipe		Tue May 12 23:01:38 2009 UTC

  Added files:                 (Branch: PHP_5_2)
    /ZendEngine2/tests	bug48248.phpt 

  Modified files:              
    /php-src	NEWS 
    /ZendEngine2	zend_object_handlers.c 
  Log:
  - MFH: Fixed bug #48248 (SIGSEGV when access to private property via &__get)
  
http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.1501&r2=1.2027.2.547.2.1502&diff_format=u
Index: php-src/NEWS
diff -u php-src/NEWS:1.2027.2.547.2.1501 php-src/NEWS:1.2027.2.547.2.1502
--- php-src/NEWS:1.2027.2.547.2.1501	Tue May 12 22:01:55 2009
+++ php-src/NEWS	Tue May 12 23:01:37 2009
@@ -12,6 +12,8 @@
 - Fixed segfault on invalid session.save_path. (Hannes)
 - Fixed leaks in imap when a mail_criteria is used. (Pierre)
 
+- Fixed bug #48248 (SIGSEGV when access to private property via &__get). 
+  (Felipe)
 - Fixed bug #48224 (Incorrect shuffle in array_rand). (Etienne)
 - Fixed bug #48221 (memory leak when passing invalid xslt parameter). (Felipe)
 - Fixed bug #48206 (Iterating over an invalid data structure
http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_object_handlers.c?r1=1.135.2.6.2.33&r2=1.135.2.6.2.34&diff_format=u
Index: ZendEngine2/zend_object_handlers.c
diff -u ZendEngine2/zend_object_handlers.c:1.135.2.6.2.33 ZendEngine2/zend_object_handlers.c:1.135.2.6.2.34
--- ZendEngine2/zend_object_handlers.c:1.135.2.6.2.33	Wed Apr  8 00:28:04 2009
+++ ZendEngine2/zend_object_handlers.c	Tue May 12 23:01:38 2009
@@ -17,7 +17,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: zend_object_handlers.c,v 1.135.2.6.2.33 2009/04/08 00:28:04 felipe Exp $ */
+/* $Id: zend_object_handlers.c,v 1.135.2.6.2.34 2009/05/12 23:01:38 felipe Exp $ */
 
 #include "zend.h"
 #include "zend_globals.h"
@@ -564,8 +564,8 @@
 		zend_guard *guard;
 
 		if (!zobj->ce->__get ||
-		    zend_get_property_guard(zobj, property_info, member, &guard) != SUCCESS ||
-		    guard->in_get) {
+			zend_get_property_guard(zobj, property_info, member, &guard) != SUCCESS ||
+			(property_info && guard->in_get)) {
 			/* we don't have access controls - will just add it */
 			new_zval = &EG(uninitialized_zval);
 

http://cvs.php.net/viewvc.cgi/ZendEngine2/tests/bug48248.phpt?view=markup&rev=1.1
Index: ZendEngine2/tests/bug48248.phpt
+++ ZendEngine2/tests/bug48248.phpt
--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