question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

strval.phpt: Output order.

See original GitHub issue

Please 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:closed
  • Created 4 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
dim-scommented, May 10, 2019

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.

0reactions
dim-scommented, Feb 24, 2020

We will not fix, because does not break backward compatibility at the code execution level.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found