You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Simple example is the optimizations/concat_null.php test:
<?php
$x = 5;
var_dump ("$x");
?>
Output should be 'string ("5")', but with rcn enabled, we get 'int (5)'.
Perhaps '"$x"' should always be converted to '(string) $x'?
Original issue reported on code.google.com by jimmehc on 2009-08-07 16:42:52
The text was updated successfully, but these errors were encountered:
Remove_concat_null removes empty concatenation on both left and right ends. Empty right
concatenation can be safely removed, but left concatenations may add an implicit string
cast.
I'm providing a patch (yet unapplied) that removes the left empty operand if the right
operand is a string. In the other cases we still remove the empty operand, but provide
a cast to string for the right expression. I believe that a cast should be faster than
the concatenation.
In the example:
$x = "" . 5;
It will be converted to:
$x = (string) 5;
Unfortunately, the wpa pass cannot handle string casts and is causing an exception.
So, we should only remove the left empty operand if the right operand is an string?
Original issue reported on code.google.com by logytech on 2010-09-06 18:10:46
The rcn pass was designed to clean up after parsing statements like "$x", rather than
for general code. So perhaps we need to do it only
Perhaps the correct solution is to only apply the transformation when the parser attributes
are there?
Or we could support casting to a string? The difficulty there is that it should call
the object's to_string handler. But if we know we don't have an object, we could just
assign the type of the expression to be a string?
I think either or both or whatever is simplest is fine.
Original issue reported on code.google.com by paul.biggar on 2010-09-07 00:03:29
Original issue reported on code.google.com by
jimmehc
on 2009-08-07 16:42:52The text was updated successfully, but these errors were encountered: