syntax error, unexpected $end

1,621 views
Skip to first unread message

squi...@versature.com

unread,
Nov 16, 2012, 10:28:27 AM11/16/12
to brow...@googlegroups.com
Hello,

I've just noticed that cron on one of our servers which has just been upgraded to Ubuntu 12.04LTS is having an issue with the browscap.ini file.

Every half an hour it runs a command along the lines of:

[ -x /usr/lib/php5/maxlifetime ] && [ -d /var/lib/php5 ] && find /var/lib/php5/ -depth -mindepth 1 -maxdepth 1 -type f -cmin +$(/usr/lib/php5/maxlifetime) ! -execdir fuser -s {} 2>/dev/null \; -delete

(which may be truncated, but the command isn't the problem, because a simple "php -v" results in the same problem). The result is that I'm getting emails telling me:

PHP: syntax error, unexpected $end, expecting ']' in /etc/php5/cli/conf.d/full_php_browscap.ini on line 63

if I view line 63, it's:

[Mozilla/?.0 (compatible\\; Ask Jeeves/Teoma*)]

I've looked for different versions of the file, and I see in some others the line doesn't contain the escape characters (\\) before the semicolon, which can cause problems, but the solution for that seems to be to insert the escape characters.

My version of the file is:

[GJK_Browscap_Version]
Version=5015
Released=Fri, 31 Aug 2012 17:50:21 -0000

which is the latest one I can find, since the project went into a restart.

The version of PHP installed on the system is:

PHP 5.3.10-1ubuntu3.4 with Suhosin-Patch (cli) (built: Sep 12 2012 18:59:41)
Copyright (c) 1997-2012 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2012 Zend Technologies

Does anyone have any suggestions on how to fix this, to remove the error, other than removing the file?

Thanks,
Simon

squi...@versature.com

unread,
Nov 16, 2012, 10:40:00 AM11/16/12
to brow...@googlegroups.com

Ah, nevermind, I worked out how to fix it.

It seems the problem was the use of the \\;, instead of \;

I changed them all with the following command:

sed -i 's:\\\\;:\\;:g' full_php_browscap.ini

and php no longer complains.

Thanks.

Orlulas

unread,
Mar 31, 2015, 4:44:33 PM3/31/15
to brow...@googlegroups.com
Hi everyone,
I've got recently the same problem when i pass my website from PHP 5.2.17 to 5.3.29 :

Warning: syntax error, unexpected $end, expecting ']' in ******/browscap.ini on line 42 in *****/class/browscap.php on line 83

Here is the content of line 42 in the version 6000 of "browscap.ini" :
[Mozilla/4.0 (compatible; MSIE 8.0*; *Windows NT 5.0; *WOW64*Trident/4.0*)* 360Spider]

Here is the content of line 83 in my PHP file :
$data = parse_ini_file($this->librairie, true);

Does anyone have a solution for this alert ? Thanks a lot by advance.
Orlulas

James Titcumb

unread,
Apr 1, 2015, 3:01:29 AM4/1/15
to browscap on behalf of Orlulas

Hey

Which browscap library are you using?

Also are you using the PHP browscap version, or the ASP version?

Thanks
James

--
You received this message because you are subscribed to the Google Groups "browscap" group.
To unsubscribe from this group and stop receiving emails from it, send an email to browscap+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Orlulas

unread,
Apr 1, 2015, 3:58:03 AM4/1/15
to brow...@googlegroups.com
Hi James and thank you for response, i'm using this PHP browscap version : http://browscap.org/stream?q=PHP_BrowsCapINI

James Titcumb

unread,
Apr 1, 2015, 4:02:29 AM4/1/15
to browscap on behalf of Orlulas
Great - and which browscap library are you using? :)

Thanks
James

On 1 April 2015 at 08:58, Orlulas via browscap <browscap+APn2wQf1ulYNtp5XbUmrv_Z...@googlegroups.com> wrote:
Hi James and thank you for response, i'm using this PHP browscap version : http://browscap.org/stream?q=PHP_BrowsCapINI

Orlulas

unread,
Apr 1, 2015, 4:04:26 AM4/1/15
to brow...@googlegroups.com
I'm using the version 6000 of the library, released Thuesday, 12 March 2015.

James Titcumb

unread,
Apr 1, 2015, 4:12:23 AM4/1/15
to browscap on behalf of Orlulas

On 1 April 2015 at 09:04, Orlulas via browscap <browscap+APn2wQf1ulYNtp5XbUmrv_Z...@googlegroups.com> wrote:
I'm using the version 6000 of the library, released Thuesday, 12 March 2015.

Orlulas

unread,
Apr 1, 2015, 4:17:35 AM4/1/15
to brow...@googlegroups.com
I'm use my own library/methode since 2009, she sort the INI file with the PHP base fonction named "parse_ini_file()". When i passed to PHP 5.3, this fonction get an new argument/mode of fonctionnement who generate a Warning when i run the code... =/

James Titcumb

unread,
Apr 1, 2015, 4:22:06 AM4/1/15
to browscap on behalf of Orlulas
Hmm - we only support the official browscap PHP library I'm afraid... https://github.com/browscap/browscap-php it does support PHP 5.3 minimum, have you tried with this library instead?

Thanks
James

On 1 April 2015 at 09:17, Orlulas via browscap <browscap+APn2wQf1ulYNtp5XbUmrv_Z...@googlegroups.com> wrote:
I'm use my own library/methode since 2009, she sort the INI file with the PHP base fonction named "parse_ini_file()". When i passed to PHP 5.3, this fonction get an new argument/mode of fonctionnement who generate a Warning when i run the code... =/

Orlulas

unread,
Apr 1, 2015, 4:36:03 AM4/1/15
to brow...@googlegroups.com
Okay, I'll go take a look to see how the INI file is parsed with this library...

Orlulas

unread,
Apr 1, 2015, 4:44:31 AM4/1/15
to brow...@googlegroups.com
For all other people, think i found the solution below : simply add this PHP test !

if (version_compare(PHP_VERSION, '5.3.0', '>=')) {
$browsers = parse_ini_file($ini_path, true, INI_SCANNER_RAW);
} else {
$browsers = parse_ini_file($ini_path, true);
}

Have a nice day =)

James Titcumb

unread,
Apr 1, 2015, 4:52:55 AM4/1/15
to browscap on behalf of Orlulas
Nice one - thanks for posting the solution for everyone else! :)

Reply all
Reply to author
Forward
0 new messages