noobified Posted September 23, 2008 Share Posted September 23, 2008 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] Quote Link to comment https://forums.phpfreaks.com/topic/125419-phpnuke-sommaire-multi-dimensional-arrays/ Share on other sites More sharing options...
Mchl Posted September 23, 2008 Share Posted September 23, 2008 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. Quote Link to comment https://forums.phpfreaks.com/topic/125419-phpnuke-sommaire-multi-dimensional-arrays/#findComment-648473 Share on other sites More sharing options...
noobified Posted September 23, 2008 Author Share Posted September 23, 2008 I would still like to know how to fix it as I like to code everything with E_ALL. Quote Link to comment https://forums.phpfreaks.com/topic/125419-phpnuke-sommaire-multi-dimensional-arrays/#findComment-648486 Share on other sites More sharing options...
Mchl Posted September 23, 2008 Share Posted September 23, 2008 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 Quote Link to comment https://forums.phpfreaks.com/topic/125419-phpnuke-sommaire-multi-dimensional-arrays/#findComment-648497 Share on other sites More sharing options...
noobified Posted September 23, 2008 Author Share Posted September 23, 2008 so could I use for e.g. !empty on the array to check it, and if so how would I do it Quote Link to comment https://forums.phpfreaks.com/topic/125419-phpnuke-sommaire-multi-dimensional-arrays/#findComment-648545 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.