Home » Database » SQL_Parser » Bug #457
Notice with function raiseError() in Parser.php
Details
| Submitted | 2003-12-19 15:22 UTC |
|---|---|
| From | coil at strangebuzz dot com |
| Assigned | busterb |
| Status | Closed |
| Package | SQL_Parser |
| PHP Version | 4.3.4 |
| OS | 2K + Easy PHP 1.7 |
| Roadmaps | (Not assigned) |
Comments
[2003-12-19 15:22 UTC] coil at strangebuzz dot com
Description:
------------
We have PHP notices in raiseError($message) function.
Reproduce code:
---------------
$parseRes = $this->SQLParser->parse("fromy CheinSELECT nUserID FROM users");
// It was to test error parsing
Expected result:
----------------
No Notice should happen.
Actual result:
--------------
Notice: Uninitialized string offset: 36 in pear\SQL\Parser.php on line 95
Notice: Uninitialized string offset: 36 in pear\SQL\Parser.php on line 96
Here is a quick patch, can you verify it :
replace :
>>>
function raiseError($message) {
$end = 0;
if ($this->lexer->string != '') {
while (($this->lexer->string{$this->lexer->lineBegin+$end} != "\n")
&& ($this->lexer->string{$this->lexer->lineBegin+$end})) {
++$end;
}
}
>>>
by
>>>
function raiseError($message) {
$TempArr = explode("\n",$this->lexer->string);
$end = strlen($TempArr[0]);
>>>>>>
COil. :)
[2003-12-19 16:41 UTC] coil at strangebuzz dot com
Changes the title of the bug...
[2003-12-21 01:45 UTC] busterb at php dot net
This bug has been fixed in CVS.
In case this was a documentation problem, the fix will show up at the
end of next Sunday (CET) on pear.php.net.
In case this was a pear.php.net website problem, the change will show
up on the website in short time.
Thank you for the report, and for helping us make PEAR better.
Hello. This is fixed in the CVS version. I'll make a release shortly to
put the fix out into the open. Thanks for the report.