First of all, i was not sure about where to post this my-two-cents post about certain fixes i did to my php-nuke install, but i think thats the right place, sorry if it is not, and yes... i said php-nuke but i think the same fixes can be applyed to RN, also i dunno exactly where i should report php-nuke issues todays...
Well, my first fix is to the file includes/counter.php (i guess i do not need to explain it :
I benchmark'ed it and it's 20% faster, also i think ereg() usage should be replaced everywhere..
Next fix is to the stripos_clone() function which is broken while running under PHP5, OPEN mainfile.php and FIND:
Code:
$return = stripos($haystack, $needle, $offset=0);
And, replace it with:
Code:
$return = stripos($haystack, $needle, $offset);
I also think adding a plain stripos() function while running under PHP4 would be a good idea, but we'll assume almost nobody is using that version nowadays...
I'm using the php-nuke 8.1 distro from NukeScripts(tm), and noticed (after some headaches) $display_errors variable is used in the wrong place, causing php errors not showing even when enabled from the admin's preferences, i just had to move the following piece of code...
Code:
// Error reporting, to be set in config.php
error_reporting(E_ALL^E_NOTICE);
if($display_errors AND is_admin($admin)) {
@ini_set('display_errors', 1);
} else {
@ini_set('display_errors', 0);
}
...to be just before:
Code:
if (!defined('FORUM_ADMIN')) {
because it was before the sql query to obtain the nuke config, where $display_errors was not set yet. and as you have noticed, i've added is_admin() usage so that only admins can see errors.
Well, my 2cents for now, if you find it useful let me know it and i'll post more
Joined: Mar 30, 2006 Posts: 2404 Location: Pennsylvania
Posted:
Wed Aug 19, 2009 4:34 pm
Thanks for taking the time to offer your insight. We are aware of the deprecation of ereg() and have an open issue to replace all instances of it. This will probably not be complete for the 2.4 release, but this shouldn't be a problem for any user unless they are using PHP 6.
Issues 2 & 3 are not found in RN, but are good advice
Thanks for taking the time to offer your insight. We are aware of the deprecation of ereg() and have an open issue to replace all instances of it. This will probably not be complete for the 2.4 release, but this shouldn't be a problem for any user unless they are using PHP 6.
just did this right now on a quick&dirty way.. it should be easy than replacing each occurence
Issues 2 & 3 are not found in RN, but are good advice
The following code comes from RN 2.30.02, the issue 2 is there
Code:
// We want to use the function stripos,
// but thats only available since PHP5.
// So we cloned the function...
if(!function_exists('stripos')) {
function stripos_clone($haystack, $needle, $offset=0) {
$return = @strpos(strtoupper($haystack), strtoupper($needle), $offset);
if ($return === false) {
return false;
} else {
return true;
}
}
} else {
// But when this is PHP5, we use the original function
function stripos_clone($haystack, $needle, $offset=0) {
$return = stripos($haystack, $needle, $offset=0); // <------ HERE ****
if ($return === false) {
return false;
} else {
return true;
}
}
}
Joined: Mar 30, 2006 Posts: 2404 Location: Pennsylvania
Posted:
Wed Aug 19, 2009 7:12 pm
meotoo wrote:
The following code comes from RN 2.30.02, the issue 2 is there
Code:
// We want to use the function stripos,
// but thats only available since PHP5.
// So we cloned the function...
if(!function_exists('stripos')) {
function stripos_clone($haystack, $needle, $offset=0) {
$return = @strpos(strtoupper($haystack), strtoupper($needle), $offset);
if ($return === false) {
return false;
} else {
return true;
}
}
} else {
// But when this is PHP5, we use the original function
function stripos_clone($haystack, $needle, $offset=0) {
$return = stripos($haystack, $needle, $offset=0); // <------ HERE ****
if ($return === false) {
return false;
} else {
return true;
}
}
}
View next topic View previous topic
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum