PDA

View Full Version : vbulletin's error notice problem


squishi
04-04-2011, 04:21 PM
I recently upgraded from vbulletin 3.8.4 (Patched) to 3.8.7.
On a custom page, I turned error reporting on:
error_reporting(E_ALL & E_NOTICE);
This setting used to be at "~E_NOTICE", so I never noticed the warning messages.

And there are loads of them.

I tried to fix some of the bugs, but there must be some other reason.

Take this one for example:
Notice: Undefined index: jsver in /forum/includes/class_core.php on line 1438

class_core.php:
$this->registry->options['simpleversion'] = SIMPLE_VERSION . $this->registry->config['Misc']['jsver'];
I assume this is accessing a setting that is not defined in the config.php.
I checked the config.php of a freshly downloaded vb script. The index "jsver" cannot be found in that file. So why is the script searching for it?


Out of curiosity, I turned the notices on for the forumdisplay.php and was hit with hundreds of notice messages.

Will a standard installation of vbulletin produce any notices if error_reporting is set to the appropriate value?

This is extremely shitty programming style! :down:

Most of the errors are undefined array index problems. They could be fixed very easily by not writing sloppy code.
Did you let your interns program vbulletin?

--------------- Added 1301939035 at 1301939035 ---------------

Maybe the developers can learn something from this small experiment:
copy this in a php file and run it:
<?php

error_reporting(0);

echo "TEST 1:<br />";
echo "notice message [if($_GET['abcdef'])]<br /><br />";

$start = microtime(true);
for($i = 1; $i < 100000; $i++)
{
if($_GET['abcdef'])
{
//
}
}
$end = microtime(true);

echo "RESULT 1: ".($end - $start)."<br /><br /><br />";

echo "TEST 2:<br />";
echo "@ parameter [if(@$_GET['abcdef'])]<br /><br />";

$start = microtime(true);
for($i = 1; $i < 100000; $i++)
{
if(@$_GET['abcdef'])
{
//
}
}
$end = microtime(true);

echo "RESULT 2: ".($end - $start)."<br /><br /><br />";

echo "TEST 3:<br />";
echo "isset check [if(isset($_GET['abcdef']))]<br /><br />";

$start = microtime(true);
for($i = 1; $i < 100000; $i++)
{
if(isset($_GET['abcdef']))
{
//
}
}
$end = microtime(true);

echo "RESULT 3: ".($end - $start)."<br /><br /><br />";


The result:
TEST 1:
notice message [if($_GET['abcdef'])]

RESULT 1: 0.071149826049805


TEST 2:
@ parameter [if(@$_GET['abcdef'])]

RESULT 2: 0.075546979904175


TEST 3:
isset check [if(isset($_GET['abcdef']))]

RESULT 3: 0.01532506942749


Sloppy programming does not pay off!

kh99
04-04-2011, 05:28 PM
Interesting results of your tests. I'm not one of the vB developers of course, so I can't say why things are that way, but I suspect fixing all those wouldn't make a lot of difference in speed since there aren't a lot of loops like that and other things take a lot longer.

BTW, E_ALL & E_NOTICE actually turns off all error reporting except E_NOTICE, so I think you'd just want E_ALL.

Paul M
04-04-2011, 05:36 PM
Was there a point to this.