PHP application stopped working after PHP upgrade to 5.3 (T_GOTO)

Written by - 0 comments

Published on - Listed in PHP Linux


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.

RSS feed

Blog Tags:

  AWS   Android   Ansible   Apache   Apple   Atlassian   BSD   Backup   Bash   Bluecoat   CMS   Chef   Cloud   Coding   Consul   Containers   CouchDB   DB   DNS   Database   Databases   Docker   ELK   Elasticsearch   Filebeat   FreeBSD   Galera   Git   GlusterFS   Grafana   Graphics   HAProxy   HTML   Hacks   Hardware   Icinga   Icingaweb   Icingaweb2   Influx   Internet   Java   KVM   Kibana   Kodi   Kubernetes   LVM   LXC   Linux   Logstash   Mac   Macintosh   Mail   MariaDB   Minio   MongoDB   Monitoring   Multimedia   MySQL   NFS   Nagios   Network   Nginx   OSSEC   OTRS   Office   PGSQL   PHP   Perl   Personal   PostgreSQL   Postgres   PowerDNS   Proxmox   Proxy   Python   Rancher   Rant   Redis   Roundcube   SSL   Samba   Seafile   Security   Shell   SmartOS   Solaris   Surveillance   Systemd   TLS   Tomcat   Ubuntu   Unix   VMWare   VMware   Varnish   Virtualization   Windows   Wireless   Wordpress   Wyse   ZFS   Zoneminder   


Update cookies preferences