mirror of
https://github.com/php/php-src.git
synced 2025-08-20 09:24:05 +02:00
Fixed bug #43344 (Wrong error message for undefined namespace constant)
This commit is contained in:
parent
ee1e57e1c4
commit
31f6f1583e
21 changed files with 332 additions and 25 deletions
11
Zend/tests/bug43343.phpt
Normal file
11
Zend/tests/bug43343.phpt
Normal file
|
@ -0,0 +1,11 @@
|
|||
--TEST--
|
||||
Bug #43343 (Variable class name)
|
||||
--FILE--
|
||||
<?php
|
||||
namespace Foo;
|
||||
class Bar { }
|
||||
$foo = 'bar';
|
||||
var_dump(new namespace::$foo);
|
||||
?>
|
||||
--EXPECTF--
|
||||
Fatal error: Cannot use 'namespace' as a class name in %sbug43343.php on line 5
|
32
Zend/tests/bug43344_1.phpt
Normal file
32
Zend/tests/bug43344_1.phpt
Normal file
|
@ -0,0 +1,32 @@
|
|||
--TEST--
|
||||
Bug #43344.1 (Wrong error message for undefined namespace constant)
|
||||
--FILE--
|
||||
<?php
|
||||
namespace Foo;
|
||||
function f1($a=bar) {
|
||||
return $a;
|
||||
}
|
||||
function f2($a=array(bar)) {
|
||||
return $a[0];
|
||||
}
|
||||
function f3($a=array(bar=>0)) {
|
||||
reset($a);
|
||||
return key($a);
|
||||
}
|
||||
echo bar."\n";
|
||||
echo f1()."\n";
|
||||
echo f2()."\n";
|
||||
echo f3()."\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
Notice: Use of undefined constant bar - assumed 'bar' in %sbug43344_1.php on line 13
|
||||
bar
|
||||
|
||||
Notice: Use of undefined constant bar - assumed 'bar' in %sbug43344_1.php on line 3
|
||||
bar
|
||||
|
||||
Notice: Use of undefined constant bar - assumed 'bar' in %sbug43344_1.php on line 6
|
||||
bar
|
||||
|
||||
Notice: Use of undefined constant bar - assumed 'bar' in %sbug43344_1.php on line 9
|
||||
bar
|
8
Zend/tests/bug43344_10.phpt
Normal file
8
Zend/tests/bug43344_10.phpt
Normal file
|
@ -0,0 +1,8 @@
|
|||
--TEST--
|
||||
Bug #43344.10 (Wrong error message for undefined namespace constant)
|
||||
--FILE--
|
||||
<?php
|
||||
echo namespace::bar."\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
Fatal error: Undefined constant 'bar' in %sbug43344_10.php on line %d
|
11
Zend/tests/bug43344_11.phpt
Normal file
11
Zend/tests/bug43344_11.phpt
Normal file
|
@ -0,0 +1,11 @@
|
|||
--TEST--
|
||||
Bug #43344.11 (Wrong error message for undefined namespace constant)
|
||||
--FILE--
|
||||
<?php
|
||||
function f($a=namespace::bar) {
|
||||
return $a;
|
||||
}
|
||||
echo f()."\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
Fatal error: Undefined constant 'bar' in %sbug43344_11.php on line %d
|
11
Zend/tests/bug43344_12.phpt
Normal file
11
Zend/tests/bug43344_12.phpt
Normal file
|
@ -0,0 +1,11 @@
|
|||
--TEST--
|
||||
Bug #43344.12 (Wrong error message for undefined namespace constant)
|
||||
--FILE--
|
||||
<?php
|
||||
function f($a=array(namespace::bar)) {
|
||||
return $a[0];
|
||||
}
|
||||
echo f()."\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
Fatal error: Undefined constant 'bar' in %sbug43344_12.php on line %d
|
12
Zend/tests/bug43344_13.phpt
Normal file
12
Zend/tests/bug43344_13.phpt
Normal file
|
@ -0,0 +1,12 @@
|
|||
--TEST--
|
||||
Bug #43344.13 (Wrong error message for undefined namespace constant)
|
||||
--FILE--
|
||||
<?php
|
||||
function f($a=array(namespace::bar=>0)) {
|
||||
reset($a);
|
||||
return key($a);
|
||||
}
|
||||
echo f()."\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
Fatal error: Undefined constant 'bar' in %sbug43344_13.php on line %d
|
9
Zend/tests/bug43344_2.phpt
Normal file
9
Zend/tests/bug43344_2.phpt
Normal file
|
@ -0,0 +1,9 @@
|
|||
--TEST--
|
||||
Bug #43344.2 (Wrong error message for undefined namespace constant)
|
||||
--FILE--
|
||||
<?php
|
||||
namespace Foo;
|
||||
echo Foo::bar."\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
Fatal error: Class 'Foo::Foo' not found in %sbug43344_2.php on line %d
|
12
Zend/tests/bug43344_3.phpt
Normal file
12
Zend/tests/bug43344_3.phpt
Normal file
|
@ -0,0 +1,12 @@
|
|||
--TEST--
|
||||
Bug #43344.3 (Wrong error message for undefined namespace constant)
|
||||
--FILE--
|
||||
<?php
|
||||
namespace Foo;
|
||||
function f($a=Foo::bar) {
|
||||
return $a;
|
||||
}
|
||||
echo f()."\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
Fatal error: Class 'Foo::Foo' not found in %sbug43344_3.php on line %d
|
12
Zend/tests/bug43344_4.phpt
Normal file
12
Zend/tests/bug43344_4.phpt
Normal file
|
@ -0,0 +1,12 @@
|
|||
--TEST--
|
||||
Bug #43344.4 (Wrong error message for undefined namespace constant)
|
||||
--FILE--
|
||||
<?php
|
||||
namespace Foo;
|
||||
function f($a=array(Foo::bar)) {
|
||||
return $a[0];
|
||||
}
|
||||
echo f()."\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
Fatal error: Class 'Foo::Foo' not found in %sbug43344_4.php on line %d
|
13
Zend/tests/bug43344_5.phpt
Normal file
13
Zend/tests/bug43344_5.phpt
Normal file
|
@ -0,0 +1,13 @@
|
|||
--TEST--
|
||||
Bug #43344.5 (Wrong error message for undefined namespace constant)
|
||||
--FILE--
|
||||
<?php
|
||||
namespace Foo;
|
||||
function f($a=array(Foo::bar=>0)) {
|
||||
reset($a);
|
||||
return key($a);
|
||||
}
|
||||
echo f()."\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
Fatal error: Class 'Foo::Foo' not found in %sbug43344_5.php on line %d
|
9
Zend/tests/bug43344_6.phpt
Normal file
9
Zend/tests/bug43344_6.phpt
Normal file
|
@ -0,0 +1,9 @@
|
|||
--TEST--
|
||||
Bug #43344.6 (Wrong error message for undefined namespace constant)
|
||||
--FILE--
|
||||
<?php
|
||||
namespace Foo;
|
||||
echo namespace::bar."\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
Fatal error: Undefined constant 'Foo::bar' in %sbug43344_6.php on line %d
|
12
Zend/tests/bug43344_7.phpt
Normal file
12
Zend/tests/bug43344_7.phpt
Normal file
|
@ -0,0 +1,12 @@
|
|||
--TEST--
|
||||
Bug #43344.7 (Wrong error message for undefined namespace constant)
|
||||
--FILE--
|
||||
<?php
|
||||
namespace Foo;
|
||||
function f($a=namespace::bar) {
|
||||
return $a;
|
||||
}
|
||||
echo f()."\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
Fatal error: Undefined constant 'Foo::bar' in %sbug43344_7.php on line %d
|
12
Zend/tests/bug43344_8.phpt
Normal file
12
Zend/tests/bug43344_8.phpt
Normal file
|
@ -0,0 +1,12 @@
|
|||
--TEST--
|
||||
Bug #43344.8 (Wrong error message for undefined namespace constant)
|
||||
--FILE--
|
||||
<?php
|
||||
namespace Foo;
|
||||
function f($a=array(namespace::bar)) {
|
||||
return $a[0];
|
||||
}
|
||||
echo f()."\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
Fatal error: Undefined constant 'Foo::bar' in %sbug43344_8.php on line %d
|
13
Zend/tests/bug43344_9.phpt
Normal file
13
Zend/tests/bug43344_9.phpt
Normal file
|
@ -0,0 +1,13 @@
|
|||
--TEST--
|
||||
Bug #43344.9 (Wrong error message for undefined namespace constant)
|
||||
--FILE--
|
||||
<?php
|
||||
namespace Foo;
|
||||
function f($a=array(namespace::bar=>0)) {
|
||||
reset($a);
|
||||
return key($a);
|
||||
}
|
||||
echo f()."\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
Fatal error: Undefined constant 'Foo::bar' in %sbug43344_9.php on line %d
|
|
@ -93,3 +93,41 @@ object(Baz)#%d (1) {
|
|||
int(2)
|
||||
}
|
||||
===DONE===
|
||||
--UEXPECTF--
|
||||
object(Foo)#%d (1) {
|
||||
[u"instanceId":u"Singleton":private]=>
|
||||
int(0)
|
||||
}
|
||||
object(Bar)#%d (1) {
|
||||
[u"instanceId":u"Singleton":private]=>
|
||||
int(1)
|
||||
}
|
||||
object(Baz)#%d (1) {
|
||||
[u"instanceId":u"Singleton":private]=>
|
||||
int(2)
|
||||
}
|
||||
object(Foo)#%d (1) {
|
||||
[u"instanceId":u"Singleton":private]=>
|
||||
int(0)
|
||||
}
|
||||
object(Bar)#%d (1) {
|
||||
[u"instanceId":u"Singleton":private]=>
|
||||
int(1)
|
||||
}
|
||||
object(Baz)#%d (1) {
|
||||
[u"instanceId":u"Singleton":private]=>
|
||||
int(2)
|
||||
}
|
||||
object(Foo)#%d (1) {
|
||||
[u"instanceId":u"Singleton":private]=>
|
||||
int(0)
|
||||
}
|
||||
object(Bar)#%d (1) {
|
||||
[u"instanceId":u"Singleton":private]=>
|
||||
int(1)
|
||||
}
|
||||
object(Baz)#%d (1) {
|
||||
[u"instanceId":u"Singleton":private]=>
|
||||
int(2)
|
||||
}
|
||||
===DONE===
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
057: Usage of 'namespace' in compound names (inside namespase)
|
||||
--FILE--
|
||||
<?php
|
||||
namespace test::ns1;
|
||||
namespace Test::ns1;
|
||||
|
||||
const C = "const ok\n";
|
||||
|
||||
|
|
|
@ -1395,6 +1395,7 @@ void zend_do_receive_arg(zend_uchar op, znode *var, znode *offset, znode *initia
|
|||
zend_arg_info *cur_arg_info;
|
||||
|
||||
if (class_type->op_type == IS_CONST &&
|
||||
Z_TYPE(class_type->u.constant) == ZEND_STR_TYPE &&
|
||||
Z_UNILEN(class_type->u.constant) == 0) {
|
||||
/* Usage of namespace as class name not in namespace */
|
||||
zval_dtor(&class_type->u.constant);
|
||||
|
@ -1758,6 +1759,7 @@ void zend_do_fetch_class(znode *result, znode *class_name TSRMLS_DC) /* {{{ */
|
|||
zend_op *opline;
|
||||
|
||||
if (class_name->op_type == IS_CONST &&
|
||||
Z_TYPE(class_name->u.constant) == ZEND_STR_TYPE &&
|
||||
Z_UNILEN(class_name->u.constant) == 0) {
|
||||
/* Usage of namespace as class name not in namespace */
|
||||
zval_dtor(&class_name->u.constant);
|
||||
|
@ -1835,9 +1837,19 @@ int zend_do_begin_class_member_function_call(znode *class_name, znode *method_na
|
|||
ulong fetch_type = 0;
|
||||
|
||||
if (class_name->op_type == IS_CONST &&
|
||||
Z_TYPE(class_name->u.constant) == ZEND_STR_TYPE &&
|
||||
Z_UNILEN(class_name->u.constant) == 0) {
|
||||
/* namespace::func() not in namespace */
|
||||
zval_dtor(&class_name->u.constant);
|
||||
if (CG(current_namespace)) {
|
||||
znode tmp;
|
||||
|
||||
tmp.op_type = IS_CONST;
|
||||
tmp.u.constant = *CG(current_namespace);
|
||||
zval_copy_ctor(&tmp.u.constant);
|
||||
zend_do_build_namespace_name(&tmp, &tmp, method_name TSRMLS_CC);
|
||||
*method_name = tmp;
|
||||
}
|
||||
return zend_do_begin_function_call(method_name, 0 TSRMLS_CC);
|
||||
}
|
||||
|
||||
|
@ -3868,6 +3880,17 @@ void zend_do_fetch_constant(znode *result, znode *constant_container, znode *con
|
|||
ulong fetch_type = 0;
|
||||
znode tmp;
|
||||
|
||||
if (constant_container &&
|
||||
constant_container->op_type == IS_CONST &&
|
||||
Z_TYPE(constant_container->u.constant) == ZEND_STR_TYPE &&
|
||||
Z_UNILEN(constant_container->u.constant) == 0) {
|
||||
/* namespace::const */
|
||||
zval_dtor(&constant_container->u.constant);
|
||||
check_namespace = 1;
|
||||
constant_container = NULL;
|
||||
fetch_type = ZEND_FETCH_CLASS_RT_NS_CHECK | IS_CONSTANT_RT_NS_CHECK;;
|
||||
}
|
||||
|
||||
switch (mode) {
|
||||
case ZEND_CT:
|
||||
if (constant_container) {
|
||||
|
@ -3881,7 +3904,7 @@ void zend_do_fetch_constant(znode *result, znode *constant_container, znode *con
|
|||
zend_do_fetch_class_name(NULL, constant_container, constant_name TSRMLS_CC);
|
||||
*result = *constant_container;
|
||||
result->u.constant.type = IS_CONSTANT | fetch_type;
|
||||
} else if (!zend_constant_ct_subst(result, &constant_name->u.constant TSRMLS_CC)) {
|
||||
} else if (fetch_type || !zend_constant_ct_subst(result, &constant_name->u.constant TSRMLS_CC)) {
|
||||
if (check_namespace && CG(current_namespace)) {
|
||||
/* We assume we use constant from the current namespace
|
||||
if it is not prefixed. */
|
||||
|
@ -3890,22 +3913,13 @@ void zend_do_fetch_constant(znode *result, znode *constant_container, znode *con
|
|||
zval_copy_ctor(&tmp.u.constant);
|
||||
zend_do_build_namespace_name(&tmp, &tmp, constant_name TSRMLS_CC);
|
||||
*constant_name = tmp;
|
||||
fetch_type = IS_CONSTANT_RT_NS_CHECK;
|
||||
fetch_type |= IS_CONSTANT_RT_NS_CHECK;
|
||||
}
|
||||
*result = *constant_name;
|
||||
result->u.constant.type = IS_CONSTANT | fetch_type;
|
||||
}
|
||||
break;
|
||||
case ZEND_RT:
|
||||
if (constant_container &&
|
||||
constant_container->op_type == IS_CONST &&
|
||||
Z_UNILEN(constant_container->u.constant) == 0) {
|
||||
/* Usage of namespace as class name not in namespace */
|
||||
zval_dtor(&constant_container->u.constant);
|
||||
constant_container = NULL;
|
||||
check_namespace = 0;
|
||||
}
|
||||
|
||||
if (constant_container ||
|
||||
!zend_constant_ct_subst(result, &constant_name->u.constant TSRMLS_CC)) {
|
||||
zend_op *opline;
|
||||
|
@ -3925,7 +3939,7 @@ void zend_do_fetch_constant(znode *result, znode *constant_container, znode *con
|
|||
tmp.u.constant = *CG(current_namespace);
|
||||
zval_copy_ctor(&tmp.u.constant);
|
||||
constant_container = &tmp;
|
||||
fetch_type = IS_CONSTANT_RT_NS_CHECK;
|
||||
fetch_type |= IS_CONSTANT_RT_NS_CHECK;
|
||||
}
|
||||
opline = get_next_op(CG(active_op_array) TSRMLS_CC);
|
||||
opline->opcode = ZEND_FETCH_CONSTANT;
|
||||
|
@ -5181,6 +5195,19 @@ void zend_do_build_namespace_name(znode *result, znode *prefix, znode *name TSRM
|
|||
|
||||
if (prefix) {
|
||||
*result = *prefix;
|
||||
if (Z_TYPE(result->u.constant) == ZEND_STR_TYPE &&
|
||||
Z_UNILEN(result->u.constant) == 0) {
|
||||
/* namespace:: */
|
||||
if (CG(current_namespace)) {
|
||||
znode tmp;
|
||||
|
||||
zval_dtor(&result->u.constant);
|
||||
tmp.op_type = IS_CONST;
|
||||
tmp.u.constant = *CG(current_namespace);
|
||||
zval_copy_ctor(&tmp.u.constant);
|
||||
zend_do_build_namespace_name(result, NULL, &tmp TSRMLS_CC);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
result->op_type = IS_CONST;
|
||||
Z_TYPE(result->u.constant) = ZEND_STR_TYPE;
|
||||
|
|
|
@ -511,7 +511,32 @@ ZEND_API int zval_update_constant_ex(zval **pp, void *arg, zend_class_entry *sco
|
|||
} else {
|
||||
colon.s++;
|
||||
}
|
||||
if ((Z_TYPE_P(p) & IS_CONSTANT_RT_NS_CHECK) == 0) {
|
||||
zend_error(E_ERROR, "Undefined class constant '%v'", colon);
|
||||
} else if (Z_TYPE_P(p) & ZEND_FETCH_CLASS_RT_NS_CHECK) {
|
||||
zend_error(E_ERROR, "Undefined constant '%v'", Z_STRVAL_P(p));
|
||||
}
|
||||
if (UG(unicode)) {
|
||||
Z_USTRLEN_P(p) -= ((colon.u - Z_USTRVAL_P(p)));
|
||||
if (inline_change) {
|
||||
colon.u = eustrndup(colon.u, Z_USTRLEN_P(p));
|
||||
efree(Z_USTRVAL_P(p));
|
||||
Z_USTRVAL_P(p) = colon.u;
|
||||
} else {
|
||||
Z_USTRVAL_P(p) = colon.u;
|
||||
}
|
||||
} else {
|
||||
Z_STRLEN_P(p) -= ((colon.s - Z_STRVAL_P(p)));
|
||||
if (inline_change) {
|
||||
colon.s = estrndup(colon.s, Z_STRLEN_P(p));
|
||||
efree(Z_STRVAL_P(p));
|
||||
Z_STRVAL_P(p) = colon.s;
|
||||
} else {
|
||||
Z_STRVAL_P(p) = colon.s;
|
||||
}
|
||||
}
|
||||
} else if (Z_TYPE_P(p) & ZEND_FETCH_CLASS_RT_NS_CHECK) {
|
||||
zend_error(E_ERROR, "Undefined constant '%v'", Z_UNIVAL_P(p));
|
||||
}
|
||||
zend_error(E_NOTICE, "Use of undefined constant %v - assumed '%v'", Z_UNIVAL_P(p), Z_UNIVAL_P(p));
|
||||
Z_TYPE_P(p) = UG(unicode) ? IS_UNICODE : IS_STRING;
|
||||
|
@ -550,10 +575,30 @@ ZEND_API int zval_update_constant_ex(zval **pp, void *arg, zend_class_entry *sco
|
|||
continue;
|
||||
}
|
||||
if (!zend_u_get_constant_ex(ZEND_STR_TYPE, str_index, str_index_len - 3, &const_value, scope, (UG(unicode) ? str_index.u[str_index_len-2] : str_index.s[str_index_len-2]) TSRMLS_CC)) {
|
||||
if ((UG(unicode) && (colon.u = u_memchr(str_index.u, ':', str_index_len - 3)) && colon.u[1] == ':') ||
|
||||
(!UG(unicode) && (colon.s = memchr(str_index.s, ':', str_index_len - 3)) && colon.s[1] == ':')
|
||||
) {
|
||||
if (UG(unicode)) {
|
||||
if ((colon.u = u_memrchr(str_index.u, ':', str_index_len - 3)) && colon.u > str_index.u && *(colon.u-1) == ':') {
|
||||
if ((str_index.u[str_index_len - 2] & IS_CONSTANT_RT_NS_CHECK) == 0) {
|
||||
zend_error(E_ERROR, "Undefined class constant '%v'", str_index);
|
||||
} else if (str_index.u[str_index_len - 2] & ZEND_FETCH_CLASS_RT_NS_CHECK) {
|
||||
zend_error(E_ERROR, "Undefined constant '%v'", str_index);
|
||||
}
|
||||
str_index_len -= ((colon.u - str_index.u) + 1);
|
||||
str_index.u = colon.u + 1;
|
||||
} else if (str_index.u[str_index_len - 2] & ZEND_FETCH_CLASS_RT_NS_CHECK) {
|
||||
zend_error(E_ERROR, "Undefined constant '%v'", str_index);
|
||||
}
|
||||
} else {
|
||||
if ((colon.s = zend_memrchr(str_index.s, ':', str_index_len - 3)) && colon.s > str_index.s && *(colon.s-1) == ':') {
|
||||
if ((str_index.s[str_index_len - 2] & IS_CONSTANT_RT_NS_CHECK) == 0) {
|
||||
zend_error(E_ERROR, "Undefined class constant '%v'", str_index);
|
||||
} else if (str_index.s[str_index_len - 2] & ZEND_FETCH_CLASS_RT_NS_CHECK) {
|
||||
zend_error(E_ERROR, "Undefined constant '%v'", str_index);
|
||||
}
|
||||
str_index_len -= ((colon.s - str_index.s) + 1);
|
||||
str_index.s = colon.s + 1;
|
||||
} else if (str_index.s[str_index_len - 2] & ZEND_FETCH_CLASS_RT_NS_CHECK) {
|
||||
zend_error(E_ERROR, "Undefined constant '%v'", str_index);
|
||||
}
|
||||
}
|
||||
zend_error(E_NOTICE, "Use of undefined constant %v - assumed '%v'", str_index, str_index);
|
||||
ZVAL_TEXTL(&const_value, str_index, str_index_len-3, 1);
|
||||
|
|
|
@ -663,14 +663,14 @@ function_call:
|
|||
class_name:
|
||||
T_STRING { $$ = $1; }
|
||||
| T_STATIC { $$.op_type = IS_CONST; ZVAL_ASCII_STRINGL(&$$.u.constant, "static", sizeof("static")-1, 1);}
|
||||
| T_NAMESPACE {if (CG(current_namespace)) { $1.op_type = IS_CONST; $1.u.constant = *CG(current_namespace); zval_copy_ctor(&$1.u.constant); zend_do_build_namespace_name(&$$, NULL, &$1 TSRMLS_CC); } else { $$.op_type = IS_CONST; ZVAL_EMPTY_TEXT(&$$.u.constant); } }
|
||||
| T_NAMESPACE { $$.op_type = IS_CONST; ZVAL_EMPTY_TEXT(&$$.u.constant); }
|
||||
| T_PAAMAYIM_NEKUDOTAYIM T_STRING { zend_do_build_namespace_name(&$$, NULL, &$2 TSRMLS_CC); }
|
||||
| class_name T_PAAMAYIM_NEKUDOTAYIM T_STRING { zend_do_build_namespace_name(&$$, &$1, &$3 TSRMLS_CC); }
|
||||
;
|
||||
|
||||
fully_qualified_class_name:
|
||||
T_STRING { $$ = $1; }
|
||||
| T_NAMESPACE {if (CG(current_namespace)) { $1.op_type = IS_CONST; $1.u.constant = *CG(current_namespace); zval_copy_ctor(&$1.u.constant); zend_do_build_namespace_name(&$$, NULL, &$1 TSRMLS_CC); } else { $$.op_type = IS_CONST; ZVAL_EMPTY_TEXT(&$$.u.constant); } }
|
||||
| T_NAMESPACE { $$.op_type = IS_CONST; ZVAL_EMPTY_TEXT(&$$.u.constant); }
|
||||
| T_PAAMAYIM_NEKUDOTAYIM T_STRING { zend_do_build_namespace_name(&$$, NULL, &$2 TSRMLS_CC); }
|
||||
| fully_qualified_class_name T_PAAMAYIM_NEKUDOTAYIM T_STRING { zend_do_build_namespace_name(&$$, &$1, &$3 TSRMLS_CC); }
|
||||
;
|
||||
|
|
|
@ -2745,6 +2745,9 @@ ZEND_VM_HANDLER(99, ZEND_FETCH_CONSTANT, VAR|UNUSED|CONST, CONST)
|
|||
|
||||
if (OP1_TYPE == IS_UNUSED) {
|
||||
if (!zend_u_get_constant(Z_TYPE(opline->op2.u.constant), Z_UNIVAL(opline->op2.u.constant), Z_UNILEN(opline->op2.u.constant), &EX_T(opline->result.u.var).tmp_var TSRMLS_CC)) {
|
||||
if (opline->extended_value & ZEND_FETCH_CLASS_RT_NS_CHECK) {
|
||||
zend_error_noreturn(E_ERROR, "Undefined constant '%R'", Z_TYPE(opline->op2.u.constant), Z_UNIVAL(opline->op2.u.constant));
|
||||
}
|
||||
zend_error(E_NOTICE, "Use of undefined constant %R - assumed '%R'",
|
||||
Z_TYPE(opline->op2.u.constant), Z_UNIVAL(opline->op2.u.constant),
|
||||
Z_TYPE(opline->op2.u.constant), Z_UNIVAL(opline->op2.u.constant));
|
||||
|
@ -2768,7 +2771,9 @@ ZEND_VM_HANDLER(99, ZEND_FETCH_CONSTANT, VAR|UNUSED|CONST, CONST)
|
|||
zval_copy_ctor(&EX_T(opline->result.u.var).tmp_var);
|
||||
ZEND_VM_NEXT_OPCODE();
|
||||
} else if ((opline->extended_value & IS_CONSTANT_RT_NS_CHECK) != 0) {
|
||||
if (!zend_u_get_constant(Z_TYPE(opline->op2.u.constant), Z_UNIVAL(opline->op2.u.constant), Z_UNILEN(opline->op2.u.constant), &EX_T(opline->result.u.var).tmp_var TSRMLS_CC)) {
|
||||
if (opline->extended_value & ZEND_FETCH_CLASS_RT_NS_CHECK) {
|
||||
zend_error_noreturn(E_ERROR, "Undefined constant '%R::%R'", Z_TYPE(opline->op1.u.constant), Z_UNIVAL(opline->op1.u.constant), Z_TYPE(opline->op2.u.constant), Z_UNIVAL(opline->op2.u.constant));
|
||||
} else if (!zend_u_get_constant(Z_TYPE(opline->op2.u.constant), Z_UNIVAL(opline->op2.u.constant), Z_UNILEN(opline->op2.u.constant), &EX_T(opline->result.u.var).tmp_var TSRMLS_CC)) {
|
||||
zend_error(E_NOTICE, "Use of undefined constant %R - assumed '%R'",
|
||||
Z_TYPE(opline->op2.u.constant), Z_UNIVAL(opline->op2.u.constant),
|
||||
Z_TYPE(opline->op2.u.constant), Z_UNIVAL(opline->op2.u.constant));
|
||||
|
|
|
@ -2568,6 +2568,9 @@ static int ZEND_FETCH_CONSTANT_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS
|
|||
|
||||
if (IS_CONST == IS_UNUSED) {
|
||||
if (!zend_u_get_constant(Z_TYPE(opline->op2.u.constant), Z_UNIVAL(opline->op2.u.constant), Z_UNILEN(opline->op2.u.constant), &EX_T(opline->result.u.var).tmp_var TSRMLS_CC)) {
|
||||
if (opline->extended_value & ZEND_FETCH_CLASS_RT_NS_CHECK) {
|
||||
zend_error_noreturn(E_ERROR, "Undefined constant '%R'", Z_TYPE(opline->op2.u.constant), Z_UNIVAL(opline->op2.u.constant));
|
||||
}
|
||||
zend_error(E_NOTICE, "Use of undefined constant %R - assumed '%R'",
|
||||
Z_TYPE(opline->op2.u.constant), Z_UNIVAL(opline->op2.u.constant),
|
||||
Z_TYPE(opline->op2.u.constant), Z_UNIVAL(opline->op2.u.constant));
|
||||
|
@ -2591,7 +2594,9 @@ static int ZEND_FETCH_CONSTANT_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS
|
|||
zval_copy_ctor(&EX_T(opline->result.u.var).tmp_var);
|
||||
ZEND_VM_NEXT_OPCODE();
|
||||
} else if ((opline->extended_value & IS_CONSTANT_RT_NS_CHECK) != 0) {
|
||||
if (!zend_u_get_constant(Z_TYPE(opline->op2.u.constant), Z_UNIVAL(opline->op2.u.constant), Z_UNILEN(opline->op2.u.constant), &EX_T(opline->result.u.var).tmp_var TSRMLS_CC)) {
|
||||
if (opline->extended_value & ZEND_FETCH_CLASS_RT_NS_CHECK) {
|
||||
zend_error_noreturn(E_ERROR, "Undefined constant '%R::%R'", Z_TYPE(opline->op1.u.constant), Z_UNIVAL(opline->op1.u.constant), Z_TYPE(opline->op2.u.constant), Z_UNIVAL(opline->op2.u.constant));
|
||||
} else if (!zend_u_get_constant(Z_TYPE(opline->op2.u.constant), Z_UNIVAL(opline->op2.u.constant), Z_UNILEN(opline->op2.u.constant), &EX_T(opline->result.u.var).tmp_var TSRMLS_CC)) {
|
||||
zend_error(E_NOTICE, "Use of undefined constant %R - assumed '%R'",
|
||||
Z_TYPE(opline->op2.u.constant), Z_UNIVAL(opline->op2.u.constant),
|
||||
Z_TYPE(opline->op2.u.constant), Z_UNIVAL(opline->op2.u.constant));
|
||||
|
@ -10154,6 +10159,9 @@ static int ZEND_FETCH_CONSTANT_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
|
|||
|
||||
if (IS_VAR == IS_UNUSED) {
|
||||
if (!zend_u_get_constant(Z_TYPE(opline->op2.u.constant), Z_UNIVAL(opline->op2.u.constant), Z_UNILEN(opline->op2.u.constant), &EX_T(opline->result.u.var).tmp_var TSRMLS_CC)) {
|
||||
if (opline->extended_value & ZEND_FETCH_CLASS_RT_NS_CHECK) {
|
||||
zend_error_noreturn(E_ERROR, "Undefined constant '%R'", Z_TYPE(opline->op2.u.constant), Z_UNIVAL(opline->op2.u.constant));
|
||||
}
|
||||
zend_error(E_NOTICE, "Use of undefined constant %R - assumed '%R'",
|
||||
Z_TYPE(opline->op2.u.constant), Z_UNIVAL(opline->op2.u.constant),
|
||||
Z_TYPE(opline->op2.u.constant), Z_UNIVAL(opline->op2.u.constant));
|
||||
|
@ -10177,7 +10185,9 @@ static int ZEND_FETCH_CONSTANT_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
|
|||
zval_copy_ctor(&EX_T(opline->result.u.var).tmp_var);
|
||||
ZEND_VM_NEXT_OPCODE();
|
||||
} else if ((opline->extended_value & IS_CONSTANT_RT_NS_CHECK) != 0) {
|
||||
if (!zend_u_get_constant(Z_TYPE(opline->op2.u.constant), Z_UNIVAL(opline->op2.u.constant), Z_UNILEN(opline->op2.u.constant), &EX_T(opline->result.u.var).tmp_var TSRMLS_CC)) {
|
||||
if (opline->extended_value & ZEND_FETCH_CLASS_RT_NS_CHECK) {
|
||||
zend_error_noreturn(E_ERROR, "Undefined constant '%R::%R'", Z_TYPE(opline->op1.u.constant), Z_UNIVAL(opline->op1.u.constant), Z_TYPE(opline->op2.u.constant), Z_UNIVAL(opline->op2.u.constant));
|
||||
} else if (!zend_u_get_constant(Z_TYPE(opline->op2.u.constant), Z_UNIVAL(opline->op2.u.constant), Z_UNILEN(opline->op2.u.constant), &EX_T(opline->result.u.var).tmp_var TSRMLS_CC)) {
|
||||
zend_error(E_NOTICE, "Use of undefined constant %R - assumed '%R'",
|
||||
Z_TYPE(opline->op2.u.constant), Z_UNIVAL(opline->op2.u.constant),
|
||||
Z_TYPE(opline->op2.u.constant), Z_UNIVAL(opline->op2.u.constant));
|
||||
|
@ -17098,6 +17108,9 @@ static int ZEND_FETCH_CONSTANT_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARG
|
|||
|
||||
if (IS_UNUSED == IS_UNUSED) {
|
||||
if (!zend_u_get_constant(Z_TYPE(opline->op2.u.constant), Z_UNIVAL(opline->op2.u.constant), Z_UNILEN(opline->op2.u.constant), &EX_T(opline->result.u.var).tmp_var TSRMLS_CC)) {
|
||||
if (opline->extended_value & ZEND_FETCH_CLASS_RT_NS_CHECK) {
|
||||
zend_error_noreturn(E_ERROR, "Undefined constant '%R'", Z_TYPE(opline->op2.u.constant), Z_UNIVAL(opline->op2.u.constant));
|
||||
}
|
||||
zend_error(E_NOTICE, "Use of undefined constant %R - assumed '%R'",
|
||||
Z_TYPE(opline->op2.u.constant), Z_UNIVAL(opline->op2.u.constant),
|
||||
Z_TYPE(opline->op2.u.constant), Z_UNIVAL(opline->op2.u.constant));
|
||||
|
@ -17121,7 +17134,9 @@ static int ZEND_FETCH_CONSTANT_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARG
|
|||
zval_copy_ctor(&EX_T(opline->result.u.var).tmp_var);
|
||||
ZEND_VM_NEXT_OPCODE();
|
||||
} else if ((opline->extended_value & IS_CONSTANT_RT_NS_CHECK) != 0) {
|
||||
if (!zend_u_get_constant(Z_TYPE(opline->op2.u.constant), Z_UNIVAL(opline->op2.u.constant), Z_UNILEN(opline->op2.u.constant), &EX_T(opline->result.u.var).tmp_var TSRMLS_CC)) {
|
||||
if (opline->extended_value & ZEND_FETCH_CLASS_RT_NS_CHECK) {
|
||||
zend_error_noreturn(E_ERROR, "Undefined constant '%R::%R'", Z_TYPE(opline->op1.u.constant), Z_UNIVAL(opline->op1.u.constant), Z_TYPE(opline->op2.u.constant), Z_UNIVAL(opline->op2.u.constant));
|
||||
} else if (!zend_u_get_constant(Z_TYPE(opline->op2.u.constant), Z_UNIVAL(opline->op2.u.constant), Z_UNILEN(opline->op2.u.constant), &EX_T(opline->result.u.var).tmp_var TSRMLS_CC)) {
|
||||
zend_error(E_NOTICE, "Use of undefined constant %R - assumed '%R'",
|
||||
Z_TYPE(opline->op2.u.constant), Z_UNIVAL(opline->op2.u.constant),
|
||||
Z_TYPE(opline->op2.u.constant), Z_UNIVAL(opline->op2.u.constant));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue