strval.phpt: Output order.
See original GitHub issuePlease add this line at the beginning of LangFunctions#strval
method, before return statement:
if (memory.isArray()) {
env.notice(trace, "Array to string conversion");
}
Please run strval.phpt.
The actual result is:
Notice: Array to string conversion in 'strval.phpt' on line 11 at pos 10
string(3) "bar"
string(3) "BAR"
string(6) "foobar"
string(1) "1"
string(3) "1.1"
string(1) "1"
string(0) ""
string(5) "Array"
but if we replace last array with variable (not constant) or remove @Immutable
annotation from LangFunctions#strval
every thing works as expected except new line before notice message.
I could only guess that constant expression are evaluated earlier then expression that needs a runtime environment to compute their values. The notice message is written to output buffer earlier then everything else.
What does this @Immutable
thing mean? It’s sort of no side effect method?
BTW, there is no javadoc on php.runtime.annotation
package annotations, please can you document them?
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (5 by maintainers)
Top Results From Across the Web
strval - Manual - PHP
As of PHP 5.2, strval() will return the string value of an object, calling its __toString() method to determine what that value is....
Read more >PHP | strval() Function - GeeksforGeeks
The strval() function is an inbuilt function in PHP and is used to convert any scalar value (string, integer, or double) to a...
Read more >PHP strval() function - w3resource
The strval() is used to convert a value of a variable to a string. Version: (PHP 4 and above). Syntax: strval(var_name). Parameter: Name ......
Read more >PHP strval() Function - W3Schools
The strval() function returns the string value of a variable. Syntax. strval(variable);. Parameter Values. Parameter, Description. variable, Required. Specifies ...
Read more >PHP | strval() Function - TutorialsPoint.dev
The strval() function is an inbuilt function in PHP and is used to convert any scalar value (string, integer, or double) to a...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
If a function is marked as
@Immutable
the all calls of this function in bytecode will be genereated as direct calls via JVM CALL instructions. This summary allows you to greatly reduce the time spent on a function call.We will not fix, because does not break backward compatibility at the code execution level.