Commit:    6ed16753c146ea2a06271ac537761430bad3059a
Author:    Xinchen Hui <larue...@php.net>         Sat, 20 Apr 2013 15:23:49 
+0800
Parents:   0704e4badb3abdfbdd5efc2b6d51c8abd6e5629a
Branches:  PHP-5.5

Link:       
http://git.php.net/?p=php-src.git;a=commitdiff;h=6ed16753c146ea2a06271ac537761430bad3059a

Log:
Fixed bug #64677 (execution operator `` stealing surrounding arguments)

Bugs:
https://bugs.php.net/64677

Changed paths:
  M  NEWS
  A  Zend/tests/bug64677.phpt
  M  Zend/zend_compile.c


Diff:
diff --git a/NEWS b/NEWS
index 969780e..15aa0bc 100644
--- a/NEWS
+++ b/NEWS
@@ -2,6 +2,10 @@ PHP                                                            
            NEWS
 |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
 ?? ??? 20??, PHP 5.5.0 Beta 4
 
+- Core:
+  . Fixed bug #64677 (execution operator `` stealing surrounding arguments). 
+    (Laruence)
+
 - Zip:
   . Fixed bug #64342 (ZipArchive::addFile() has to check for file existence).
     (Anatol)
diff --git a/Zend/tests/bug64677.phpt b/Zend/tests/bug64677.phpt
new file mode 100644
index 0000000..44a7c5f
--- /dev/null
+++ b/Zend/tests/bug64677.phpt
@@ -0,0 +1,21 @@
+--TEST--
+Bug #64677 (execution operator `` stealing surrounding arguments)
+--FILE--
+<?PHP
+class cat {
+       public function show_output($prepend, $output = '') {
+       }
+}
+$cat = new cat();
+$cat->show_output('Files: ', trim(`cd .`)); // this gives invalid args to 
shell_exec
+$cat->show_output('Files: ', `cd .`); // this causes a segmentation fault
+$cat->show_output(`cd .`); // this causes a segmentation fault
+
+function show_outputa($prepend, $output) {
+       echo "Okey";
+}
+show_outputa('Files: ', `cd .`); // this works as expected
+
+?>
+--EXPECT--
+Okey
diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c
index 7680790..3c0d753 100644
--- a/Zend/zend_compile.c
+++ b/Zend/zend_compile.c
@@ -5702,6 +5702,7 @@ void zend_do_shell_exec(znode *result, const znode *cmd 
TSRMLS_DC) /* {{{ */
        GET_CACHE_SLOT(opline->op1.constant);
        opline->extended_value = 1;
        SET_UNUSED(opline->op2);
+       opline->op2.num = CG(context).nested_calls;
        GET_NODE(result, opline->result);
 
        if (CG(context).nested_calls + 1 > CG(active_op_array)->nested_calls) {


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

Reply via email to