Jump to content

Archived

This topic is now archived and is closed to further replies.

noobified

phpnuke + Sommaire + Multi-Dimensional Arrays

Recommended Posts

I'm trying to fix an old phpnuke script called sommaire. Sommaire is like an advanced menu system.I have a massive amount of errors when I set error reporting to E_ALL, I know this can be turned off but I would also like to understand what the problem is.All the errors I am getting seem to me Undefined Index's and Offsets.

 

e.g.

 

[23-Sep-2008 15:11:03] PHP Notice:  Undefined index:  0 in sommaire.php on line 967

 

now the code relevant to this is

 

964		$now = time();
965		if (strpos($days_link[$groupmenu[$keysommaire]][$z],'8')!==false || $now<$date_debut_link[$groupmenu[$keysommaire]][$z] || ($date_fin_link[$groupmenu[$keysommaire]][$z]>0 && $now>$date_fin_link[$groupmenu[$keysommaire]][$z])) {
966		//il faut !== car si 8 est en première position, strpos retourne 0 (qui est différent de false, mais != ne fait pas la différence)
967		$linkclass=" class=\"sommaire_hidden\"";
968		}
969		else {
970			$linkclass="";
971		}

 

Can anyone explain why this error exists, The whole script seems to be using Multi-Dimensional Arrays???????

 

This is just one of many errors but If someone could help me understand this one I may be able to figure out the rest.

 

I have also attached the complete script in case it is needed.

 

Thanks

 

 

 

 

 

 

[attachment deleted by admin]

Share this post


Link to post
Share on other sites

I was having a site with nuke and sommaire... I'm glad I moved.

 

The notice you're getting is indeed related to arrays, but there are no arrays in line 967...

 

Anyway it says, that there isn't a key in the array, for which the script tries to reference to... It's similar to undeclared variable. You can safely ignore this one I suppose.

Share this post


Link to post
Share on other sites

Then you must make sure, that arrays have all the indexes that are requested from them

 

$arr = array("foo" => "hoo", "bar" => "boo");

$a = $arr["baz"];   // this will trigger the notice

$arr["baz"] = NULL;

$b = $arr["baz"];   //now the notice is gone

Share this post


Link to post
Share on other sites

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.