Header RSS Feed
 
If you only want to see the articles of a certain category, please click on the desired category below:
ALL Android Backup BSD Database Hacks Hardware Internet Linux Mail MySQL Monitoring Network Personal PHP Proxy Shell Solaris Unix Virtualization VMware Windows Wyse

PHP application stopped working after PHP upgrade to 5.3 (T_GOTO)
Monday - Dec 9th 2013 - by - (0 comments)

Funny issue on a PHP application which was previously running on PHP 5.2 and now since on PHP 5.3. Right after the migration the application stopped working.

Once I set the display_errors flag to 'on', the following error appeared:

Parse error: syntax error, unexpected T_GOTO, expecting T_STRING or '(' in /var/www/www.example.com/html/de/myapp/inc/inc_functions.php on line 174

In the mentioned php script on line 174 and found this:

function goto ($url){
echo "<script language=\"JavaScript\">
      window.setTimeout('window.location.href=\"$url\"','10')
      </script>";}

Doesn't look wrong to me, or does it?

Actually since PHP 5.3 the function name "goto" is now a reserved function and cannot be used as a function name anymore (source).

So I simply renamed the function to goto2:

function goto2 ($url){
echo "<script language=\"JavaScript\">
      window.setTimeout('window.location.href=\"$url\"','10')
      </script>";}

Of course I needed to replace the function name wherever it was used in this particular php application (around 15 different php scripts). After this change the web-application was running fine again.

 

Add a comment

Show form to leave a comment

Comments (newest first):

No comments yet.

Go to Homepage home
Linux Howtos how to's
Monitoring Plugins monitoring plugins
Links links

Valid HTML 4.01 Transitional
Valid CSS!
[Valid RSS]

7367 Days
until Death of Computers
Why?