Jump to content

phpnuke + Sommaire + Multi-Dimensional Arrays


noobified

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]

Link to comment
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.

Link to comment
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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.