1
0
mirror of https://github.com/dg/dibi.git synced 2025-08-09 23:56:58 +02:00

DibiTranslator: deprecated support for hex number in strings '0xFF' (BC break)

related to PHP7 and https://wiki.php.net/rfc/remove_hex_support_in_numeric_strings
This commit is contained in:
David Grudl
2015-06-15 14:08:03 +02:00
parent 66afffcddc
commit d3151f7c65
2 changed files with 4 additions and 7 deletions

View File

@@ -361,8 +361,11 @@ final class DibiTranslator extends DibiObject
return 'NULL';
} elseif (is_string($value) && preg_match('#[+-]?\d++(?:e\d+)?\z#A', $value)) {
return $value; // support for long numbers - keep them unchanged
} elseif (is_string($value) && substr($value, 1, 1) === 'x' && is_numeric($value)) {
trigger_error('Support for hex strings has been deprecated.', E_USER_DEPRECATED);
return (string) hexdec($value);
} else {
return (string) (int) ($value + 0);
return (string) (int) $value;
}
case 'f': // float