Skip to content

Commit

Permalink
Merge pull request ifsnop#63 from lukeb/master
Browse files Browse the repository at this point in the history
Missing leading zeros in numeric string values
  • Loading branch information
ifsnop committed Sep 3, 2014
2 parents 2a3a135 + 526263a commit 23bbbc4
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/Ifsnop/Mysqldump/Mysqldump.php
Original file line number Diff line number Diff line change
Expand Up @@ -351,8 +351,9 @@ private function escape($arr)
foreach ($arr as $val) {
if (is_null($val)) {
$ret[] = "NULL";
} elseif (ctype_digit($val)) {
// faster than "(string) intval($val) === $val"
} elseif (ctype_digit($val) && (string) intval($val) === $val) {
// Since "(string) intval($val) === $val" is slower, first check ctype_digit, then run comparison
// We can't use ctype_digit alone, as this will trim off leading zeros on string values
// but will quote negative integers (not a big deal IMHO)
$ret[] = $val;
} else {
Expand Down

0 comments on commit 23bbbc4

Please sign in to comment.