sgrodzicki / php-sql-parser

Automatically exported from code.google.com/p/php-sql-parser
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

Parser throws uninitialized offsets warning when "REPLACE" MySQL function used in SELECT clause #156

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
Hello,

Using the replace function in MySQL (the str_replace of MySQL) in a SELECT 
clause will cause the parser to throw PHP notices & warnings.

Example: Query is :
SELECT test_ID, 
test_name, 
    REPLACE(   test_name  , 'aa', 'bb') AS 'test_name_modified'
FROM  test  
ORDER BY test_name ASC; 

Notice: Undefined index: alias in  
PHP-SQL-Parser\src\processors\OrderByProcessor.php on line 69 
Notice: Undefined index: INTO in 
PHP-SQL-Parser\src\processors\InsertProcessor.php on line 50 
Warning: Invalid argument supplied for foreach() in 
PHP-SQL-Parser\src\processors\InsertProcessor.php on line 51 
Notice: Uninitialized string offset: 0 in  
PHP-SQL-Parser\src\processors\AbstractProcessor.php on line 66  
Notice: Uninitialized string offset: 0 in  
PHP-SQL-Parser\src\processors\AbstractProcessor.php on line 71 
Notice: Uninitialized string offset: 0 in  
PHP-SQL-Parser\src\processors\AbstractProcessor.php on line 76

I am using php-sql-parser version SVN: $Id: PHPSQLParser.php 757 2013-12-16 
09:54:05Z phosco@gmx.de $
with  PHP  5.4.6

Is there a way around this? It "works" but I like to have a clean output, 
without warnings & notices. 

Thank you!

Original issue reported on code.google.com by charline...@gmail.com on 22 Dec 2014 at 3:20