When I upgraded to PHP 4.3.9 on this server I would occasionally get an error that didn’t make any sense. The two that I saw were:
Parse error: parse error, unexpected T_VARIABLE in (filename) on line 10
Warning: Unexpected character in input: ‘ (filename) on line 20
The line numbers didn’t have anything that I can see that are wrong with them, and they varied across different files.
Some related links I found during my research:
PHP bug 5448
PHP bug 14141
PHP bug 24864
PHP bug 30241
PHP bugs search
Computing news
Redhat bugzilla
Sitepoint
The problem seems to happen when I’m working on a file and making changes to it, then reload the page in the browser. So far it’s a complete mystery. I restarted the server and wasn’t able to reproduce it right away, but that doesn’t mean it’s resolved.
The server is a dual-CPU machine, and the 4.2.3 changelog says, “Fixed several bugs in the multithreaded version that could cause random parse errors, especially on machines with multiple CPUs.” I wonder if the bugs were reintroduced in later versions.
I got the following error:
Warning: Unexpected character in input: ‘ in (filename) on line 163
On line 163 I had the following:
echo isset( $search_email )
and towards the end of the page I got the following error:
Fatal error: Call to undefined function: sset() in (filename)on line 163
My guess is that the letter i in isset was somehow construed to be invalid when the file was parsed and as a result it tried to find the sset method instead of the isset method. After a reload, everything worked fine so the PHP code is syntactically correct.
I just found a test that seemed to work pretty well. I had a foreach block and when I put an @ symbol in front of the foreach, it threw a parse error at first (which is correct) but when I removed it on versions 4.3.9, 4.3.8 and 4.3.6 it produced one more error, then another reload cleared the error. This behavior no longer occurred when I downgraded to 4.3.4. I would put the @ symbol in and it would give the parse error (a different error too by the way) and then when I removed it from the file and reloaded, it worked fine.
It appears that there was a problem with older versions of the Zend Optimizer and PHP. On their downloads page, they wrote:
“Note: Due to an incompatibility between earlier versions of Zend Optimizer and PHP 4.3.10, it’s recommended to upgrade to the latest version.”
They also referenced bug 31108.
I’m having the same problem after upgrading to PHP 4.3.10. I even tried upgrading ZendOptimizer (as suggested by Dan) but I still have those random errors.
Have you found a solution yet?
Rafael: Not yet. I tried upgrading to a later release but got the same problem, so I reverted back to the working version (at least for me).
If you learn anything else about this, please let me know.