mirror of
https://github.com/dg/dibi.git
synced 2025-08-04 21:28:02 +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:
@@ -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
|
||||
|
@@ -73,12 +73,6 @@ Assert::same(
|
||||
$conn->translate("SELECT %f", '-.12345678912345678912345678e10')
|
||||
);
|
||||
|
||||
// hex numbers
|
||||
Assert::same(
|
||||
reformat('SELECT 17'),
|
||||
$conn->translate("SELECT %i", '0x11')
|
||||
);
|
||||
|
||||
// invalid input
|
||||
$e = Assert::exception(function() use ($conn) {
|
||||
$conn->translate("SELECT %s", (object) array(123), ', %m', 123);
|
||||
|
Reference in New Issue
Block a user