logo       

cvs: ZendEngine2 / zend_interfaces.c zend_vm_def.h zend_vm_execute.h /test: msg#00082

Subject: cvs: ZendEngine2 / zend_interfaces.c zend_vm_def.h zend_vm_execute.h /tests bug26229.phpt
helly           Tue Jan 25 05:40:51 2005 EDT

  Modified files:              
    /ZendEngine2        zend_interfaces.c zend_vm_def.h zend_vm_execute.h 
    /ZendEngine2/tests  bug26229.phpt 
  Log:
  - Bugfix #26229 (getIterator() segfaults when it returns arrays or scalars)
  
  
http://cvs.php.net/diff.php/ZendEngine2/zend_interfaces.c?r1=1.24&r2=1.25&ty=u
Index: ZendEngine2/zend_interfaces.c
diff -u ZendEngine2/zend_interfaces.c:1.24 ZendEngine2/zend_interfaces.c:1.25
--- ZendEngine2/zend_interfaces.c:1.24  Mon Jan 24 14:18:37 2005
+++ ZendEngine2/zend_interfaces.c       Tue Jan 25 05:40:50 2005
@@ -16,11 +16,12 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: zend_interfaces.c,v 1.24 2005/01/24 19:18:37 helly Exp $ */
+/* $Id: zend_interfaces.c,v 1.25 2005/01/25 10:40:50 helly Exp $ */
 
 #include "zend.h"
 #include "zend_API.h"
 #include "zend_interfaces.h"
+#include "zend_exceptions.h"
 
 ZEND_API zend_class_entry *zend_ce_traversable;
 ZEND_API zend_class_entry *zend_ce_aggregate;
@@ -275,7 +276,7 @@
        if (!ce || !ce_it || !ce_it->get_iterator || (ce_it->get_iterator == 
zend_user_it_get_new_iterator && iterator == object)) {
                if (!EG(exception))
                {
-                       zend_error(E_WARNING, "Objects returned by 
%s::getIterator() must be traversable or implement interface Iterator", 
ce->name);
+                       zend_throw_exception_ex(NULL, 0 TSRMLS_CC, "Objects 
returned by %s::getIterator() must be traversable or implement interface 
Iterator", ce->name);
                }
                if (iterator)
                {
http://cvs.php.net/diff.php/ZendEngine2/zend_vm_def.h?r1=1.11&r2=1.12&ty=u
Index: ZendEngine2/zend_vm_def.h
diff -u ZendEngine2/zend_vm_def.h:1.11 ZendEngine2/zend_vm_def.h:1.12
--- ZendEngine2/zend_vm_def.h:1.11      Tue Jan 25 05:07:52 2005
+++ ZendEngine2/zend_vm_def.h   Tue Jan 25 05:40:50 2005
@@ -16,7 +16,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: zend_vm_def.h,v 1.11 2005/01/25 10:07:52 helly Exp $ */
+/* $Id: zend_vm_def.h,v 1.12 2005/01/25 10:40:50 helly Exp $ */
 
 ZEND_VM_HANDLER(1, ZEND_ADD, CONST|TMP|VAR|CV, CONST|TMP|VAR|CV)
 {
@@ -2872,6 +2872,9 @@
                        } else {
                                FREE_OP1_IF_VAR();
                        }
+                       if (!EG(exception)) {
+                               zend_throw_exception_ex(NULL, 0 TSRMLS_CC, 
"Object of type %s did not create an Iterator", ce->name);
+                       }
                        zend_throw_exception_internal(NULL TSRMLS_CC);
                        ZEND_VM_NEXT_OPCODE();
                }
http://cvs.php.net/diff.php/ZendEngine2/zend_vm_execute.h?r1=1.13&r2=1.14&ty=u
Index: ZendEngine2/zend_vm_execute.h
diff -u ZendEngine2/zend_vm_execute.h:1.13 ZendEngine2/zend_vm_execute.h:1.14
--- ZendEngine2/zend_vm_execute.h:1.13  Tue Jan 25 05:07:52 2005
+++ ZendEngine2/zend_vm_execute.h       Tue Jan 25 05:40:50 2005
@@ -16,7 +16,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: zend_vm_execute.h,v 1.13 2005/01/25 10:07:52 helly Exp $ */
+/* $Id: zend_vm_execute.h,v 1.14 2005/01/25 10:40:50 helly Exp $ */
 
 
 #define ZEND_VM_CONTINUE() return 0
@@ -1968,6 +1968,9 @@
                        } else {
                                ;
                        }
+                       if (!EG(exception)) {
+                               zend_throw_exception_ex(NULL, 0 TSRMLS_CC, 
"Object of type %s did not create an Iterator", ce->name);
+                       }
                        zend_throw_exception_internal(NULL TSRMLS_CC);
                        ZEND_VM_NEXT_OPCODE();
                }
@@ -4384,6 +4387,9 @@
                        } else {
                                ;
                        }
+                       if (!EG(exception)) {
+                               zend_throw_exception_ex(NULL, 0 TSRMLS_CC, 
"Object of type %s did not create an Iterator", ce->name);
+                       }
                        zend_throw_exception_internal(NULL TSRMLS_CC);
                        ZEND_VM_NEXT_OPCODE();
                }
@@ -7462,6 +7468,9 @@
                        } else {
                                if (free_op1.var) 
{zval_ptr_dtor(&free_op1.var);};
                        }
+                       if (!EG(exception)) {
+                               zend_throw_exception_ex(NULL, 0 TSRMLS_CC, 
"Object of type %s did not create an Iterator", ce->name);
+                       }
                        zend_throw_exception_internal(NULL TSRMLS_CC);
                        ZEND_VM_NEXT_OPCODE();
                }
@@ -18238,6 +18247,9 @@
                        } else {
                                ;
                        }
+                       if (!EG(exception)) {
+                               zend_throw_exception_ex(NULL, 0 TSRMLS_CC, 
"Object of type %s did not create an Iterator", ce->name);
+                       }
                        zend_throw_exception_internal(NULL TSRMLS_CC);
                        ZEND_VM_NEXT_OPCODE();
                }
@@ -30537,6 +30549,9 @@
                        } else {
                                FREE_OP_IF_VAR(free_op1);
                        }
+                       if (!EG(exception)) {
+                               zend_throw_exception_ex(NULL, 0 TSRMLS_CC, 
"Object of type %s did not create an Iterator", ce->name);
+                       }
                        zend_throw_exception_internal(NULL TSRMLS_CC);
                        ZEND_VM_NEXT_OPCODE();
                }
http://cvs.php.net/diff.php/ZendEngine2/tests/bug26229.phpt?r1=1.1&r2=1.2&ty=u
Index: ZendEngine2/tests/bug26229.phpt
diff -u ZendEngine2/tests/bug26229.phpt:1.1 ZendEngine2/tests/bug26229.phpt:1.2
--- ZendEngine2/tests/bug26229.phpt:1.1 Mon Dec 22 17:51:09 2003
+++ ZendEngine2/tests/bug26229.phpt     Tue Jan 25 05:40:51 2005
@@ -11,11 +11,19 @@
 
 $obj = new array_iterator;
 
-foreach ($obj as $property => $value) {
-        var_dump($value);
+try
+{
+       foreach ($obj as $property => $value)
+       {
+               var_dump($value);
+       }
+}
+catch(Exception $e)
+{
+       echo $e->getMessage() . "\n";
 }
 ?>
 ===DONE===
 --EXPECTF--
-Warning: Objects returned by array_iterator::getIterator() must be traversable 
or implement interface Iterator in %sbug26229.php on line %d
-===DONE===
\ No newline at end of file
+Objects returned by array_iterator::getIterator() must be traversable or 
implement interface Iterator
+===DONE===

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




<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

Recently Viewed:
audio.irate.dev...    yellowdog.gener...    ietf.ips/2002-0...    xfree86.fonts/2...    busybox/2003-07...    emacs.jdee/2004...    linux.mandrake....    hardware.microc...    user-groups.lin...    science.analysi...    version-control...    db.filemaker.de...    cluster.openmos...    mail.eyebrowse....    text.xml.xerces...    kde.devel.kwrit...    finance.moneyda...    gcc.regression/...    network.routing...    os.freebsd.deve...    recreation.radi...    qnx.openqnx.dev...    python.xml/2002...   
Home | blog view | USPTO Patent Archive | advertise | OSDir is an inevitable website. super tiny logo

Free Magazines

Cisco News
Receive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business.
subscribe

Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field.
subscribe

The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business.
subscribe

Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe

Total Telecom Total Telecom is "The Economist of the communications industry".
subscribe