]> granicus.if.org Git - php/commitdiff
Fixed bug #41919
authorDmitry Stogov <dmitry@php.net>
Mon, 9 Jul 2007 08:56:29 +0000 (08:56 +0000)
committerDmitry Stogov <dmitry@php.net>
Mon, 9 Jul 2007 08:56:29 +0000 (08:56 +0000)
Zend/tests/bug41919.phpt [new file with mode: 0644]
Zend/zend_execute.c

diff --git a/Zend/tests/bug41919.phpt b/Zend/tests/bug41919.phpt
new file mode 100644 (file)
index 0000000..3ba9ae0
--- /dev/null
@@ -0,0 +1,11 @@
+--TEST--
+Bug #41919 (crash in string to array conversion)
+--FILE--
+<?php
+$foo="50";
+$foo[3]->bar[1] = "bang";
+
+echo "ok\n";
+?>
+--EXPECTF--
+Fatal error: Cannot use string offset as an object in %s/bug41919.php on line %d
index f632fe7d3b5c9a1fd50e587f90b9ce804c14b83f..8a761db62ebe2770b7f1ff597acfac049cf592ad 100644 (file)
@@ -1239,6 +1239,10 @@ static void zend_fetch_property_address(temp_variable *result, zval **container_
 {
        zval *container;
 
+       if (!container_ptr) {
+               zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
+       }
+
        container = *container_ptr;
        if (container == EG(error_zval_ptr)) {
                if (result) {