1
0
mirror of https://github.com/dg/dibi.git synced 2025-08-05 21:58:10 +02:00

fixed invalid escaping sequences in double quoted strings, used \z instead of $

This commit is contained in:
David Grudl
2012-10-18 22:06:19 +02:00
parent 43f5e08296
commit f51ac0b67e
3 changed files with 3 additions and 3 deletions

View File

@@ -69,7 +69,7 @@ class DibiSqliteReflector extends DibiObject implements IDibiReflector
$columns = array(); $columns = array();
while ($row = $res->fetch(TRUE)) { while ($row = $res->fetch(TRUE)) {
$column = $row['name']; $column = $row['name'];
$pattern = "/(\"$column\"|\[$column\]|$column)\s+[^,]+\s+PRIMARY\s+KEY\s+AUTOINCREMENT/Ui"; $pattern = "/(\"$column\"|\[$column\]|$column)\\s+[^,]+\\s+PRIMARY\\s+KEY\\s+AUTOINCREMENT/Ui";
$type = explode('(', $row['type']); $type = explode('(', $row['type']);
$columns[] = array( $columns[] = array(
'name' => $column, 'name' => $column,

View File

@@ -181,7 +181,7 @@ class DibiFluent extends DibiObject implements IDataSource
if ($arg === TRUE) { // flag if ($arg === TRUE) { // flag
return $this; return $this;
} elseif (is_string($arg) && preg_match('#^[a-z:_][a-z0-9_.:]*$#i', $arg)) { // identifier } elseif (is_string($arg) && preg_match('#^[a-z:_][a-z0-9_.:]*\z#i', $arg)) { // identifier
$args = array('%n', $arg); $args = array('%n', $arg);
} elseif (is_array($arg) || ($arg instanceof Traversable && !$arg instanceof self)) { // any array } elseif (is_array($arg) || ($arg instanceof Traversable && !$arg instanceof self)) { // any array

View File

@@ -353,7 +353,7 @@ final class DibiTranslator extends DibiObject
case 'i': // signed int case 'i': // signed int
case 'u': // unsigned int, ignored case 'u': // unsigned int, ignored
// support for long numbers - keep them unchanged // support for long numbers - keep them unchanged
if (is_string($value) && preg_match('#[+-]?\d++(e\d+)?$#A', $value)) { if (is_string($value) && preg_match('#[+-]?\d++(e\d+)?\z#A', $value)) {
return $value; return $value;
} else { } else {
return $value === NULL ? 'NULL' : (string) (int) ($value + 0); return $value === NULL ? 'NULL' : (string) (int) ($value + 0);