johannes                                 Fri, 23 Oct 2009 16:47:35 +0000

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

Log:
Fix #49972 (AppendIterator undefined function crash)

Bug: http://bugs.php.net/49972 (Open) AppendIterator undefined function crash
      
Changed paths:
    U   php/php-src/branches/PHP_5_2/NEWS
    U   php/php-src/branches/PHP_5_2/ext/spl/spl_iterators.c
    A   php/php-src/branches/PHP_5_2/ext/spl/tests/bug49972.phpt
    U   php/php-src/branches/PHP_5_3/ext/spl/spl_iterators.c
    A   php/php-src/branches/PHP_5_3/ext/spl/tests/bug49972.phpt
    U   php/php-src/trunk/ext/spl/spl_iterators.c
    A   php/php-src/trunk/ext/spl/tests/bug49972.phpt

Modified: php/php-src/branches/PHP_5_2/NEWS
===================================================================
--- php/php-src/branches/PHP_5_2/NEWS   2009-10-23 15:51:39 UTC (rev 289889)
+++ php/php-src/branches/PHP_5_2/NEWS   2009-10-23 16:47:35 UTC (rev 289890)
@@ -12,6 +12,7 @@
 - Fixed crash when instantiating PDORow and PDOStatement through Reflection.
   (Felipe)

+- Fixed bug #49972 (AppendIterator undefined function crash). (Johannes)
 - Fixed bug #49855 (import_request_variables() always returns NULL). (Ilia,
   sjoerd at php dot net)
 - Fixed bug #49847 (exec() fails to return data inside 2nd parameter, given

Modified: php/php-src/branches/PHP_5_2/ext/spl/spl_iterators.c
===================================================================
--- php/php-src/branches/PHP_5_2/ext/spl/spl_iterators.c        2009-10-23 
15:51:39 UTC (rev 289889)
+++ php/php-src/branches/PHP_5_2/ext/spl/spl_iterators.c        2009-10-23 
16:47:35 UTC (rev 289890)
@@ -818,7 +818,7 @@
        intern = (spl_dual_it_object*)zend_object_store_get_object(*object_ptr 
TSRMLS_CC);

        function_handler = std_object_handlers.get_method(object_ptr, method, 
method_len TSRMLS_CC);
-       if (!function_handler) {
+       if (!function_handler && intern->inner.ce) {
                if (zend_hash_find(&intern->inner.ce->function_table, method, 
method_len+1, (void **) &function_handler) == FAILURE) {
                        if (Z_OBJ_HT_P(intern->inner.zobject)->get_method) {
                                *object_ptr = intern->inner.zobject;

Added: php/php-src/branches/PHP_5_2/ext/spl/tests/bug49972.phpt
===================================================================
--- php/php-src/branches/PHP_5_2/ext/spl/tests/bug49972.phpt                    
        (rev 0)
+++ php/php-src/branches/PHP_5_2/ext/spl/tests/bug49972.phpt    2009-10-23 
16:47:35 UTC (rev 289890)
@@ -0,0 +1,11 @@
+--TEST--
+Bug #49972 (AppendIterator undefined function crash)
+--FILE--
+<?php
+
+$iterator = new AppendIterator();
+$iterator->undefined();
+
+?>
+--EXPECTF--
+Fatal error: Call to undefined method AppendIterator::undefined() in %s on 
line %d


Property changes on: php/php-src/branches/PHP_5_2/ext/spl/tests/bug49972.phpt
___________________________________________________________________
Added: svn:executable
   + *

Modified: php/php-src/branches/PHP_5_3/ext/spl/spl_iterators.c
===================================================================
--- php/php-src/branches/PHP_5_3/ext/spl/spl_iterators.c        2009-10-23 
15:51:39 UTC (rev 289889)
+++ php/php-src/branches/PHP_5_3/ext/spl/spl_iterators.c        2009-10-23 
16:47:35 UTC (rev 289890)
@@ -1166,7 +1166,7 @@
        intern = (spl_dual_it_object*)zend_object_store_get_object(*object_ptr 
TSRMLS_CC);

        function_handler = std_object_handlers.get_method(object_ptr, method, 
method_len TSRMLS_CC);
-       if (!function_handler) {
+       if (!function_handler && intern->inner.ce) {
                if (zend_hash_find(&intern->inner.ce->function_table, method, 
method_len+1, (void **) &function_handler) == FAILURE) {
                        if (Z_OBJ_HT_P(intern->inner.zobject)->get_method) {
                                *object_ptr = intern->inner.zobject;

Added: php/php-src/branches/PHP_5_3/ext/spl/tests/bug49972.phpt
===================================================================
--- php/php-src/branches/PHP_5_3/ext/spl/tests/bug49972.phpt                    
        (rev 0)
+++ php/php-src/branches/PHP_5_3/ext/spl/tests/bug49972.phpt    2009-10-23 
16:47:35 UTC (rev 289890)
@@ -0,0 +1,11 @@
+--TEST--
+Bug #49972 (AppendIterator undefined function crash)
+--FILE--
+<?php
+
+$iterator = new AppendIterator();
+$iterator->undefined();
+
+?>
+--EXPECTF--
+Fatal error: Call to undefined method AppendIterator::undefined() in %s on 
line %d


Property changes on: php/php-src/branches/PHP_5_3/ext/spl/tests/bug49972.phpt
___________________________________________________________________
Added: svn:executable
   + *

Modified: php/php-src/trunk/ext/spl/spl_iterators.c
===================================================================
--- php/php-src/trunk/ext/spl/spl_iterators.c   2009-10-23 15:51:39 UTC (rev 
289889)
+++ php/php-src/trunk/ext/spl/spl_iterators.c   2009-10-23 16:47:35 UTC (rev 
289890)
@@ -1215,7 +1215,7 @@
        intern = (spl_dual_it_object*)zend_object_store_get_object(*object_ptr 
TSRMLS_CC);

        function_handler = std_object_handlers.get_method(object_ptr, method, 
method_len TSRMLS_CC);
-       if (!function_handler) {
+       if (!function_handler && intern->inner.ce) {
                if (zend_u_hash_find(&intern->inner.ce->function_table, 
IS_UNICODE, method, method_len+1, (void **) &function_handler) == FAILURE) {
                        if (Z_OBJ_HT_P(intern->inner.zobject)->get_method) {
                                *object_ptr = intern->inner.zobject;

Added: php/php-src/trunk/ext/spl/tests/bug49972.phpt
===================================================================
--- php/php-src/trunk/ext/spl/tests/bug49972.phpt                               
(rev 0)
+++ php/php-src/trunk/ext/spl/tests/bug49972.phpt       2009-10-23 16:47:35 UTC 
(rev 289890)
@@ -0,0 +1,11 @@
+--TEST--
+Bug #49972 (AppendIterator undefined function crash)
+--FILE--
+<?php
+
+$iterator = new AppendIterator();
+$iterator->undefined();
+
+?>
+--EXPECTF--
+Fatal error: Call to undefined method AppendIterator::undefined() in %s on 
line %d


Property changes on: php/php-src/trunk/ext/spl/tests/bug49972.phpt
___________________________________________________________________
Added: svn:executable
   + *

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

Reply via email to