simple-tags client.php Warning: array_keys() / shuffle()

von Joern am 1. Apr. 2010 | Keine Kommentare

How to solve these warnings!
On some of my WordPress sites the error.log showed me errors and warnings like:
Warning: array_keys() [function.array-keys]: The first argument should be an array in …wp-contentpluginssimple-tagsincclient.php on line 1310
Warning: shuffle() expects parameter 1 to be array, null given in …wp-contentpluginssimple-tagsincclient.php on line 1311
Warning: Invalid argument supplied for foreach() in …wp-contentpluginssimple-tagsincclient.php on line 1312
This is a file of the Plugin Simple Tags Version:
Google finds thousands of sites throwing this error, lucky I am not alone I thought.
However, looking at the mentioned lines in client.php I didn’t find the problem first, the ‚function randomArray‘ is for something ‚Random‘ I thought.
BUT: There is a simple typing error in this function, line 1309 in client.php reads:

function randomArray( &$array )

while it should correctly be like:

function randomArray(&$array)

So I would say remove the white space before and after &$array and you are done!
This part should look like this finally:

* Randomize an array and keep association
* @param array $array
* @return boolean
function randomArray(&$array) {
$keys = array_keys($array);
foreach($keys as $key) {
$new[$key] = $array[$key];
$array = $new;

return true;
you find me on Google+, Twitter and Facebook

(von: master)

Hier noch 1 weitere Ergebnisse dieses Threads:

Re: simple-tags client.php Warning: array_keys() / shuffle() :: Reply by Joern

7. Apr. 2010 (von: Joern)

The solution for this 'Warning: array_keys() [function.array-keys]: The first argument should be an array in ...wp-contentpluginssimple-tagsincclient.php on line 1310'is for me to add some code in client.phpThis code checks is the passed argument $... Weiterlesen →


Du findest mich auch auf Twitter und Facebook!

Schreibe einen Kommentar

Pflichtfelder sind mit * markiert.

Diese Website verwendet Akismet, um Spam zu reduzieren. Erfahre mehr darüber, wie deine Kommentardaten verarbeitet werden.

weitere forum Beiträge: