Commit f81c5c3b authored by zYne's avatar zYne

fixed fatal bug in sql explode

parent ebfc0971
...@@ -191,11 +191,12 @@ class Doctrine_Tokenizer ...@@ -191,11 +191,12 @@ class Doctrine_Tokenizer
$str = preg_split('/(' . implode('|', $d) . ')/', $str); $str = preg_split('/(' . implode('|', $d) . ')/', $str);
$d = stripslashes($d[0]); $d = stripslashes($d[0]);
} else { } else {
$str = explode("$d",$str); $str = explode($d, $str);
} }
$i = 0; $i = 0;
$term = array(); $term = array();
foreach ($str as $key => $val) { foreach ($str as $key => $val) {
if (empty($term[$i])) { if (empty($term[$i])) {
$term[$i] = trim($val); $term[$i] = trim($val);
...@@ -203,11 +204,11 @@ class Doctrine_Tokenizer ...@@ -203,11 +204,11 @@ class Doctrine_Tokenizer
$s1 = substr_count($term[$i], $e1); $s1 = substr_count($term[$i], $e1);
$s2 = substr_count($term[$i], $e2); $s2 = substr_count($term[$i], $e2);
if (substr($term[$i],0,1) == '(') { if (strpos($term[$i], '(') !== false) {
if($s1 == $s2) { if($s1 == $s2) {
$i++; $i++;
} }
} else { } else {
if ( ! (substr_count($term[$i], "'") & 1) && if ( ! (substr_count($term[$i], "'") & 1) &&
! (substr_count($term[$i], "\"") & 1)) { ! (substr_count($term[$i], "\"") & 1)) {
$i++; $i++;
...@@ -218,13 +219,13 @@ class Doctrine_Tokenizer ...@@ -218,13 +219,13 @@ class Doctrine_Tokenizer
$c1 = substr_count($term[$i], $e1); $c1 = substr_count($term[$i], $e1);
$c2 = substr_count($term[$i], $e2); $c2 = substr_count($term[$i], $e2);
if (substr($term[$i], 0, 1) == '(') { if (strpos($term[$i], '(') !== false) {
if($c1 == $c2) { if($c1 == $c2) {
$i++; $i++;
} }
} else { } else {
if ( ! (substr_count($term[$i], "'") & 1) && if ( ! (substr_count($term[$i], "'") & 1) &&
! (substr_count($term[$i], "\"") & 1)) { ! (substr_count($term[$i], "\"") & 1)) {
$i++; $i++;
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment