hi friends, I have my sites in a dedicated server with php4 and everything is work great. But now I want to upgrade my php to version 5 and someone has give me a test server with php5 to test my sites. The only problem, is that in some sites, I got to many errors. Can someone help me fixing them? Unfortunately, I don't understand anything about php knowledge to fix this errors my own. I don't wanna scare you guys, so I will put one error as a time. So first error is: Line 806 of wp_smf.php file is: foreach ($basliklar as $baslik) { Code (markup): Some part of the code: foreach ($basliklar as $baslik) { $content .= $mesajdanonce. 'Secção: <a href="'.$boardurl .'?board=' . $baslik->ID_BOARD .'.0">'.$baslik->bName.'</a><br>'.__('Tópico:','wp_smf').' <a href="' . $boardurl . '?topic=' . $baslik->ID_TOPIC . '.msg' . $baslik->ID_MSG . ';topicseen#new" class="smflastpost">'. $baslik->subject .'</a><br><span class="smfpostextra">'.__('Último post por:','wp_smf').' <b>'. $baslik->posterName .'</b> '.__('às','wp_smf').' '. date("H:i - d.m.Y",$baslik->posterTime + get_settings('gmt_offset') * 3600) .'</span>'.$mesajdansonra; $count = $count + 1; } Code (markup): Can someone help me fixing this one? I don't understand why is working in php4 and don't work with php5. If you need the full code, please let me know. I really appreciate your help guys. Thank you!
http://de.php.net/foreach $baslik is an object and you have to work with them differently in php5 then it was in php4. http://de.php.net/manual/en/language.oop5.iterations.php
Thank you for the help exodus. But damn, I don't understand anything about php to fix this error. Can you or someone help me?
i don't think its a php4 to php5 problem. you are trying to traverse a non-object/non-array variable. add a "if (!empty($basliklar))" before your foreach besides that, i think your error reporting level is set too high. http://il.php.net/manual/en/function.error-reporting.php
Do as yoavmatchulsky said or you can also do this: Just add 1 line before foreach: if(!is_array($basliklar)) $basliklar = array(); foreach ($basliklar as $baslik) { PHP:
hi friends, thank you so much for your reply's. I did the both solutions and the error disappeared. But was supposed to appear the last forum comments... and instead of that, don't appears anything. What could be wrong? Any more ideas? Here is the full code if you want to see: http://enigma.webhs.pt/wp_smf.php.txt Thank you for your time. I really appreciate that. P.S. Sorry for my poor english.
Probably the difference between the two servers is that the PHP4 one has register_globals on and in the PHP5 one it is off. User needs to learn about $_GET / $_POST / $_REQUEST.
SmallPotatoes, thank you mate for your reply. I have turned register_globals on in the PHP5 server but the errors is still appearing Any more ideas friends?
Don't turn register_globals on! They made the default to turn it off for a very good reason. It makes your scripts into security nightmares. Better to invest the time and fix them so that they work without it, rather than deal with the cleanup when your server is hacked.
Ok, thank you for the advice. But can someone help me fixing this error that I have in my site? My php knowledge is zero and I really need some help.
is it for your WP blog only or entire sites in the server ? if it is just the WP, usually upgrading the WP along with plugin should work
Hi madguy24, thank you for your reply. Is only for a WP plugin, and I got the last version of It. Please, someone?
problem solved! yeah! In the plugin configuration, was needed to change the path of the forum. From: /home/7arte/public_html/forum To: /home/enigmaw/public_html/forum Thank you anyway guys This solved not one error, but all php errors in the site hehe