cvs: ZendEngine2(PHP_5_3) / zend_compile.c /tests ns_039.phpt ns_040.phpt ns_059.phpt
| From: | Dmitry Stogov | Date: | Thu, 22 Nov 2007 10:46:27 +0000 |
| Subject: | cvs: ZendEngine2(PHP_5_3) / zend_compile.c /tests ns_039.phpt ns_040.phpt ns_059.phpt | ||
| Groups: | php.zend-engine.cvs | ||
| Request: | Send a blank email to php-zend-engine-cvs+get-6205@lists.php.net to get a copy of this message | ||
dmitry Thu Nov 22 10:46:27 2007 UTC
Added files: (Branch: PHP_5_3)
/ZendEngine2/tests ns_059.phpt
Modified files:
/ZendEngine2 zend_compile.c
/ZendEngine2/tests ns_039.phpt ns_040.phpt
Log:
Fixed bug #43318
The "const" statement is still allowed outside of namespaces but arrays are disabled.
http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_compile.c?r1=1.647.2.27.2.41.2.24&r2=1.647.2.27.2.41.2.25&diff_format=u
Index: ZendEngine2/zend_compile.c
diff -u ZendEngine2/zend_compile.c:1.647.2.27.2.41.2.24
ZendEngine2/zend_compile.c:1.647.2.27.2.41.2.25
--- ZendEngine2/zend_compile.c:1.647.2.27.2.41.2.24 Thu Nov 22 09:02:53 2007
+++ ZendEngine2/zend_compile.c Thu Nov 22 10:46:26 2007
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: zend_compile.c,v 1.647.2.27.2.41.2.24 2007/11/22 09:02:53 dmitry Exp $ */
+/* $Id: zend_compile.c,v 1.647.2.27.2.41.2.25 2007/11/22 10:46:26 dmitry Exp $ */
#include <zend_language_parser.h>
#include "zend.h"
@@ -4820,6 +4820,10 @@
{
zend_op *opline;
+ if(Z_TYPE(value->u.constant) == IS_CONSTANT_ARRAY) {
+ zend_error(E_COMPILE_ERROR, "Arrays are not allowed as constants");
+ }
+
if (zend_get_ct_const(&name->u.constant TSRMLS_CC)) {
zend_error(E_COMPILE_ERROR, "Cannot redeclare constant '%s'",
Z_STRVAL(name->u.constant));
}
http://cvs.php.net/viewvc.cgi/ZendEngine2/tests/ns_039.phpt?r1=1.1.2.2&r2=1.1.2.3&diff_format=u
Index: ZendEngine2/tests/ns_039.phpt
diff -u ZendEngine2/tests/ns_039.phpt:1.1.2.2 ZendEngine2/tests/ns_039.phpt:1.1.2.3
--- ZendEngine2/tests/ns_039.phpt:1.1.2.2 Fri Sep 28 19:52:52 2007
+++ ZendEngine2/tests/ns_039.phpt Thu Nov 22 10:46:26 2007
@@ -2,22 +2,24 @@
039: Constant declaration
--FILE--
<?php
+function foo($a = A) {
+ echo "$a\n";
+}
+function bar($a = array(A => B)) {
+ foreach ($a as $key => $val) {
+ echo "$key\n";
+ echo "$val\n";
+ }
+}
const A = "ok";
const B = A;
-const C = array("ok");
-const D = array(B);
echo A . "\n";
echo B . "\n";
-print_r(C);
-print_r(D);
+foo();
+bar();
--EXPECT--
ok
ok
-Array
-(
- [0] => ok
-)
-Array
-(
- [0] => ok
-)
+ok
+ok
+ok
http://cvs.php.net/viewvc.cgi/ZendEngine2/tests/ns_040.phpt?r1=1.1.2.3&r2=1.1.2.4&diff_format=u
Index: ZendEngine2/tests/ns_040.phpt
diff -u ZendEngine2/tests/ns_040.phpt:1.1.2.3 ZendEngine2/tests/ns_040.phpt:1.1.2.4
--- ZendEngine2/tests/ns_040.phpt:1.1.2.3 Wed Nov 7 09:09:21 2007
+++ ZendEngine2/tests/ns_040.phpt Thu Nov 22 10:46:26 2007
@@ -6,9 +6,6 @@
use X as Y;
const A = "ok\n";
const B = A;
-const C = array(A);
-const D = array("aaa"=>A);
-const E = array(A=>"aaa\n");
function f1($x=A) {
echo $x;
}
@@ -42,9 +39,6 @@
f3();
f4();
echo B;
-$x = C; echo $x[0];
-$x = D; echo $x["aaa"];
-$x = E; echo $x["ok\n"];
f5();
f6();
f7();
@@ -61,8 +55,5 @@
ok
ok
ok
-aaa
-ok
-ok
ok
aaa
http://cvs.php.net/viewvc.cgi/ZendEngine2/tests/ns_059.phpt?view=markup&rev=1.1
Index: ZendEngine2/tests/ns_059.phpt
+++ ZendEngine2/tests/ns_059.phpt