Would searching for the string "&$" work if I'm searching for all call-by-reference actions pertinent to PHP < 5.3?
This may be a stupid move on my part, but due to restrictions on making the development environment identical to the production, I plan on using GREP to replace all "&$" with just "$". That should be a good enough band aid to continue development, right?
What would the cons be in doing this?
Search String
Moderator: General Moderators
Re: Search String
(it's called "call-time pass-by-reference")
That would also catch
A better match would be
to be replaced with
Emphasis on "better", as in "not necessarily perfect".
Honestly, I'd rather fix each occurrence as PHP finds it - then there's no risk of accidentally screwing up code.
That would also catch
Code: Select all
$var=&$othervar;
array($var, &$othervar);Code: Select all
\b(?!array)(\w+\s*)\(([^)]*?)(^|,)(\s*)&(\s*)\$Code: Select all
$1($2$3$4$5\$Honestly, I'd rather fix each occurrence as PHP finds it - then there's no risk of accidentally screwing up code.
Re: Search String
Ah, I see...tasairis wrote:(it's called "call-time pass-by-reference")
Even if there's thousands to fix?tasairis wrote:Honestly, I'd rather fix each occurrence as PHP finds it - then there's no risk of accidentally screwing up code.
Re: Search String
Run your search-and-replace, but be prepared to handle other problems that develop.Wolf_22 wrote:Even if there's thousands to fix?tasairis wrote:Honestly, I'd rather fix each occurrence as PHP finds it - then there's no risk of accidentally screwing up code.