|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2012-04-09 15:33 UTC] [email protected]
Description:
------------
if use '@', you can call function in a string substitution context.
Test script:
---------------
<?php
$la = "ooxx";
$a = "${@substr('laruence', 0, 2)}";
echo $a;
Expected result:
----------------
PHP Error: syntax error
Actual result:
--------------
ooxx
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Nov 03 11:00:02 2025 UTC |
This is typically a limitation of our grammar. We accept ${ string_varname } and ${ expr } due to the fact that ${asd} is not accessing the variable named after the constant asd's value. When the lexer looks at ${ function_call() } it finds ${ T_STRING_VARNAME() } which will not parse. We might be able to fix it by looking ahead in the <ST_LOOKING_FOR_VARNAME>{LABEL} { rule and detect cases where it should be a T_STRING, i.e if the char after it is either } [ or {.