shazahm1 / WP-Syntax

WP-Syntax WordPress Plugin
connections-pro.com
GNU General Public License v2.0
13 stars 11 forks source link

lots of PHP warnings in error logs #15

Open gfairchild opened 10 years ago

gfairchild commented 10 years ago

I get a number of PHP warnings in my error logs when a page using WP-Syntax is accessed on my site:

[Sun Jan 05 04:35:09 2014] [error] [client x.x.x.x] PHP Warning:  array_keys() expects parameter 1 to be array, null given in ~/public_html/wordpress/wp-content/plugins/wp-syntax/geshi/geshi.php on line 2039
[Sun Jan 05 04:35:09 2014] [error] [client x.x.x.x] PHP Warning:  Invalid argument supplied for foreach() in ~/public_html/wordpress/wp-content/plugins/wp-syntax/geshi/geshi.php on line 2039
[Sun Jan 05 04:35:09 2014] [error] [client x.x.x.x] PHP Warning:  Invalid argument supplied for foreach() in ~/public_html/wordpress/wp-content/plugins/wp-syntax/geshi/geshi.php on line 2411
[Sun Jan 05 04:35:09 2014] [error] [client x.x.x.x] PHP Warning:  implode(): Argument must be an array in ~/public_html/wordpress/wp-content/plugins/wp-syntax/geshi/geshi.php on line 3365
[Sun Jan 05 04:35:09 2014] [error] [client x.x.x.x] PHP Warning:  array_keys() expects parameter 1 to be array, null given in ~/public_html/wordpress/wp-content/plugins/wp-syntax/geshi/geshi.php on line 3388
[Sun Jan 05 04:35:09 2014] [error] [client x.x.x.x] PHP Warning:  Invalid argument supplied for foreach() in ~/public_html/wordpress/wp-content/plugins/wp-syntax/geshi/geshi.php on line 3388
[Sun Jan 05 04:35:09 2014] [error] [client x.x.x.x] PHP Warning:  Invalid argument supplied for foreach() in ~/public_html/wordpress/wp-content/plugins/wp-syntax/geshi/geshi.php on line 3429
[Sun Jan 05 04:35:09 2014] [error] [client x.x.x.x] PHP Warning:  array_keys() expects parameter 1 to be array, null given in ~/public_html/wordpress/wp-content/plugins/wp-syntax/geshi/geshi.php on line 3481
[Sun Jan 05 04:35:09 2014] [error] [client x.x.x.x] PHP Warning:  Invalid argument supplied for foreach() in ~/public_html/wordpress/wp-content/plugins/wp-syntax/geshi/geshi.php on line 3481
[Sun Jan 05 04:35:09 2014] [error] [client x.x.x.x] PHP Warning:  array_keys() expects parameter 1 to be array, null given in ~/public_html/wordpress/wp-content/plugins/wp-syntax/geshi/geshi.php on line 3626
[Sun Jan 05 04:35:09 2014] [error] [client x.x.x.x] PHP Warning:  Invalid argument supplied for foreach() in ~/public_html/wordpress/wp-content/plugins/wp-syntax/geshi/geshi.php on line 3626
[Sun Jan 05 04:35:09 2014] [error] [client x.x.x.x] PHP Warning:  array_keys() expects parameter 1 to be array, null given in ~/public_html/wordpress/wp-content/plugins/wp-syntax/geshi/geshi.php on line 2039
[Sun Jan 05 04:35:09 2014] [error] [client x.x.x.x] PHP Warning:  Invalid argument supplied for foreach() in ~/public_html/wordpress/wp-content/plugins/wp-syntax/geshi/geshi.php on line 2039
[Sun Jan 05 04:35:09 2014] [error] [client x.x.x.x] PHP Warning:  Invalid argument supplied for foreach() in ~/public_html/wordpress/wp-content/plugins/wp-syntax/geshi/geshi.php on line 2411
[Sun Jan 05 04:35:09 2014] [error] [client x.x.x.x] PHP Warning:  implode(): Argument must be an array in ~/public_html/wordpress/wp-content/plugins/wp-syntax/geshi/geshi.php on line 3365
[Sun Jan 05 04:35:09 2014] [error] [client x.x.x.x] PHP Warning:  array_keys() expects parameter 1 to be array, null given in ~/public_html/wordpress/wp-content/plugins/wp-syntax/geshi/geshi.php on line 3388
[Sun Jan 05 04:35:09 2014] [error] [client x.x.x.x] PHP Warning:  Invalid argument supplied for foreach() in ~/public_html/wordpress/wp-content/plugins/wp-syntax/geshi/geshi.php on line 3388
[Sun Jan 05 04:35:09 2014] [error] [client x.x.x.x] PHP Warning:  Invalid argument supplied for foreach() in ~/public_html/wordpress/wp-content/plugins/wp-syntax/geshi/geshi.php on line 3429
[Sun Jan 05 04:35:09 2014] [error] [client x.x.x.x] PHP Warning:  array_keys() expects parameter 1 to be array, null given in ~/public_html/wordpress/wp-content/plugins/wp-syntax/geshi/geshi.php on line 3481
[Sun Jan 05 04:35:09 2014] [error] [client x.x.x.x] PHP Warning:  Invalid argument supplied for foreach() in ~/public_html/wordpress/wp-content/plugins/wp-syntax/geshi/geshi.php on line 3481
[Sun Jan 05 04:35:09 2014] [error] [client x.x.x.x] PHP Warning:  array_keys() expects parameter 1 to be array, null given in ~/public_html/wordpress/wp-content/plugins/wp-syntax/geshi/geshi.php on line 3626
[Sun Jan 05 04:35:09 2014] [error] [client x.x.x.x] PHP Warning:  Invalid argument supplied for foreach() in ~/public_html/wordpress/wp-content/plugins/wp-syntax/geshi/geshi.php on line 3626

Looks like the same erroneous use of foreach, array_keys, and implode is used repeatedly throughout geshi.php.

shazahm1 commented 10 years ago

Hmm, I do not get those in my log. but, honestly I'm running this yet unrelease branch: https://github.com/shazahm1/WP-Syntax/tree/feature/cache

Testing the cache feature of this pull: https://github.com/shazahm1/WP-Syntax/pull/9

Seems to work very well for me ... so, maybe install the version from that branch.

I haven't checked the geshi site in a while, I might need to pull an updated version from there and merge it.

gfairchild commented 10 years ago

That could be it. I'm running PHP 5.3.10 (on Ubuntu 12.04 LTS), so that could possibly play a roll, too. Maybe the way they use each of those constructs is ok under PHP > 5.3.10.

shazahm1 commented 10 years ago

Hmmm, maybe. I'm on 5.4

gfairchild commented 10 years ago

It could also be differing error reporting values in php.ini. I'm currently using error_reporting = E_ALL & ~E_DEPRECATED.

Maybe when 14.04 LTS comes out in a few months (and PHP subsequently gets upgraded), the warnings will disappear. Or maybe when the next WP-Syntax gets released, it'll fix it. They're just warnings, so I'll just ignore them for now.