PHP-SugarNewsWikiDocsBugsForumFilesSource LoginRegister
HomeBugsBug #0002
Variables not initialized
Bug #0002
Reported by Christian Achatz (unregistered)
Feb 10th, 2008 at 12:18pm EST
Running the test/index.php the PHP interpreter displays a lot of

Notice: Undefined variable: ar in ***\php-sugar-0.72\Sugar\Tokenizer.php on line 197

notices. IMHO this variable should be initialized to avoid notices and to be save to code injections. Changing the code to

// skip spaces and comments
while (($ar = $this->getRegex('/(\s+|(?:\/\*.*?\*\/|\/\/.*?($|%>)))/msA')) !== false) {
// line comment ended with a %\>
if ($ar[1] == '%>') {
$this->inCmd = false;
return array('term', '%>');
}
}

helps to avoid these message, but produces some

Notice: Undefined offset: 2 in ***\php-sugar-0.72\Sugar\Parser.php on line 509

or

Notice: Undefined offset: 0 in ***\php-sugar-0.72\Sugar\Runtime.php on line 368

messages.

I tested the software on a windows xp sp2 box with apache 2.0.52 and php 5.2.3.

Regards,
Christian Achatz from adventure-php-framework.org

Comment from Thomas Buhk
Feb 11th, 2008 at 11:46am
This problem result in using E_STRICT error reporting enabled in your php.ini. E_STRICT was added to php with version 5. With version 6 E_STRICT is also member of E_ALL so php-suger should develop with E_ALL and E_STRICT warnings on!

Comment from Sean Middleditch
Feb 11th, 2008 at 8:44pm
I'll be taking care of these with the next release. Thanks for reporting!

Comment from Sean Middleditch
Feb 11th, 2008 at 10:11pm
I've correct all three of these errors, as well as fixed up some tests and added a new one for comments. These fixes are in SVN, and will be in the 0.73 release.

Comment from Thomas Buhk
Feb 12th, 2008 at 5:28am
E_STRICT now works, thanks sean :)

Additional Comments:
or Login