[Solar-talk] Solar_Sql_Select bug

Paul M Jones pmjones at paul-m-jones.com
Sat May 17 17:20:44 CDT 2008


Hi Jeff,

On May 14, 2008, at 14:34 , Jeff Moore wrote:

> I found a small bug.  This code fails to detect an parenthesis in  
> position 0.
>
> Solar/Sql/Select.php:1043
>                $parens = strpos($col, '(');
>
>                // choose our column-name deconfliction strategy
>                if ($prefix == '' || $parens || $count_sources == 1) {
>
> You could use
>
> $parens = (strpos($col, '(') === FALSE);
>
> To fix the bug

This check is in place to see if an SQL function is being used (noted  
in a comment on line 1042).  Yes, just looking for a parenthesis is  
naive.  ;-)  However, if the paren is the first char in the string,  
it's not likely related to an SQL function.

Did you run into a situation where this caused you some trouble?


-- pmj


More information about the Solar-talk mailing list