dmitry                                   Tue, 28 Jul 2009 13:01:40 +0000

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

Log:
Fixed bug #49037 (@list( $b ) = $a; causes a crash)

Bug: http://bugs.php.net/49037 (Assigned) @list( $b ) = $a; causes a crash
      
Changed paths:
    A   php/php-src/trunk/Zend/tests/bug49037.phpt
    U   php/php-src/trunk/Zend/zend_vm_def.h
    U   php/php-src/trunk/Zend/zend_vm_execute.h

Added: php/php-src/trunk/Zend/tests/bug49037.phpt
===================================================================
--- php/php-src/trunk/Zend/tests/bug49037.phpt                          (rev 0)
+++ php/php-src/trunk/Zend/tests/bug49037.phpt  2009-07-28 13:01:40 UTC (rev 
286454)
@@ -0,0 +1,14 @@
+--TEST--
+Bug #49037 (@list( $b ) = $a; causes a crash)
+--FILE--
+<?php
+$a = array( "c" );
+...@list( $b ) = $a;
+print_r( $a );
+?>
+--EXPECT--
+Array
+(
+    [0] => c
+)
+

Modified: php/php-src/trunk/Zend/zend_vm_def.h
===================================================================
--- php/php-src/trunk/Zend/zend_vm_def.h        2009-07-28 12:36:08 UTC (rev 
286453)
+++ php/php-src/trunk/Zend/zend_vm_def.h        2009-07-28 13:01:40 UTC (rev 
286454)
@@ -1491,6 +1491,9 @@
        if (OP1_TYPE == IS_VAR && EX_T(opline->op1.u.var).var.ptr == NULL) {
                zend_error_noreturn(E_ERROR, "Cannot use string offset as an 
array");
        }
+       if (OP1_TYPE == IS_VAR && EX_T(opline->op1.u.var).var.ptr_ptr) {
+               PZVAL_LOCK(*EX_T(opline->op1.u.var).var.ptr_ptr);
+       }
        container = GET_OP1_ZVAL_PTR(BP_VAR_R);
        if (Z_TYPE_P(container) != IS_ARRAY) {
                if (!RETURN_VALUE_UNUSED(&opline->result)) {

Modified: php/php-src/trunk/Zend/zend_vm_execute.h
===================================================================
--- php/php-src/trunk/Zend/zend_vm_execute.h    2009-07-28 12:36:08 UTC (rev 
286453)
+++ php/php-src/trunk/Zend/zend_vm_execute.h    2009-07-28 13:01:40 UTC (rev 
286454)
@@ -2680,6 +2680,9 @@
        if (IS_CONST == IS_VAR && EX_T(opline->op1.u.var).var.ptr == NULL) {
                zend_error_noreturn(E_ERROR, "Cannot use string offset as an 
array");
        }
+       if (IS_CONST == IS_VAR && EX_T(opline->op1.u.var).var.ptr_ptr) {
+               PZVAL_LOCK(*EX_T(opline->op1.u.var).var.ptr_ptr);
+       }
        container = &opline->op1.u.constant;
        if (Z_TYPE_P(container) != IS_ARRAY) {
                if (!RETURN_VALUE_UNUSED(&opline->result)) {
@@ -6117,6 +6120,9 @@
        if (IS_TMP_VAR == IS_VAR && EX_T(opline->op1.u.var).var.ptr == NULL) {
                zend_error_noreturn(E_ERROR, "Cannot use string offset as an 
array");
        }
+       if (IS_TMP_VAR == IS_VAR && EX_T(opline->op1.u.var).var.ptr_ptr) {
+               PZVAL_LOCK(*EX_T(opline->op1.u.var).var.ptr_ptr);
+       }
        container = _get_zval_ptr_tmp(&opline->op1, EX(Ts), &free_op1 
TSRMLS_CC);
        if (Z_TYPE_P(container) != IS_ARRAY) {
                if (!RETURN_VALUE_UNUSED(&opline->result)) {
@@ -10579,6 +10585,9 @@
        if (IS_VAR == IS_VAR && EX_T(opline->op1.u.var).var.ptr == NULL) {
                zend_error_noreturn(E_ERROR, "Cannot use string offset as an 
array");
        }
+       if (IS_VAR == IS_VAR && EX_T(opline->op1.u.var).var.ptr_ptr) {
+               PZVAL_LOCK(*EX_T(opline->op1.u.var).var.ptr_ptr);
+       }
        container = _get_zval_ptr_var(&opline->op1, EX(Ts), &free_op1 
TSRMLS_CC);
        if (Z_TYPE_P(container) != IS_ARRAY) {
                if (!RETURN_VALUE_UNUSED(&opline->result)) {
@@ -24941,6 +24950,9 @@
        if (IS_CV == IS_VAR && EX_T(opline->op1.u.var).var.ptr == NULL) {
                zend_error_noreturn(E_ERROR, "Cannot use string offset as an 
array");
        }
+       if (IS_CV == IS_VAR && EX_T(opline->op1.u.var).var.ptr_ptr) {
+               PZVAL_LOCK(*EX_T(opline->op1.u.var).var.ptr_ptr);
+       }
        container = _get_zval_ptr_cv(&opline->op1, EX(Ts), BP_VAR_R TSRMLS_CC);
        if (Z_TYPE_P(container) != IS_ARRAY) {
                if (!RETURN_VALUE_UNUSED(&opline->result)) {

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

Reply via email to