. Removed support for assigning the result of new by reference. (Nikita)
. Invalid octal literals in source code now produce compile errors, fixes PHPSadness #31. (Andrea)
. Removed dl() function on fpm-fcgi. (Nikita)
+ . Removed support for hexadecimal numeric strings. (Nikita)
- Date:
. Fixed day_of_week function as it could sometimes return negative values
PHPSadness #31. Previously, the invalid digits (and any following valid
digits) were simply ignored, such that 0781 became 7.
. Removed dl() function on fpm-fcgi.
+ . Removed support for hexadecimal numeric strings. This means that some
+ operations like == will no longer specially interpret strings containing
+ hexadecimal numbers. Furthermore is_numeric() will not consider hexadecimal
+ strings to be numeric (use FILTER_VALIDATE_INT instead).
+ (RFC: https://wiki.php.net/rfc/remove_hex_support_in_numeric_strings)
- Date:
. Removed $is_dst parameter from mktime() and gmmktime().
ZEND_API zend_uchar _is_numeric_string_ex(const char *str, size_t length, zend_long *lval, double *dval, int allow_errors, int *oflow_info) /* {{{ */
{
const char *ptr;
- int base = 10, digits = 0, dp_or_e = 0;
+ int digits = 0, dp_or_e = 0;
double local_dval = 0.0;
zend_uchar type;
}
if (ZEND_IS_DIGIT(*ptr)) {
- /* Handle hex numbers
- * str is used instead of ptr to disallow signs and keep old behavior */
- if (length > 2 && *str == '0' && (str[1] == 'x' || str[1] == 'X')) {
- base = 16;
- ptr += 2;
- }
-
/* Skip any leading 0s */
while (*ptr == '0') {
ptr++;
* a full match, stop when there are too many digits for a long */
for (type = IS_LONG; !(digits >= MAX_LENGTH_OF_LONG && (dval || allow_errors == 1)); digits++, ptr++) {
check_digits:
- if (ZEND_IS_DIGIT(*ptr) || (base == 16 && ZEND_IS_XDIGIT(*ptr))) {
+ if (ZEND_IS_DIGIT(*ptr)) {
continue;
- } else if (base == 10) {
- if (*ptr == '.' && dp_or_e < 1) {
- goto process_double;
- } else if ((*ptr == 'e' || *ptr == 'E') && dp_or_e < 2) {
- const char *e = ptr + 1;
+ } else if (*ptr == '.' && dp_or_e < 1) {
+ goto process_double;
+ } else if ((*ptr == 'e' || *ptr == 'E') && dp_or_e < 2) {
+ const char *e = ptr + 1;
- if (*e == '-' || *e == '+') {
- ptr = e++;
- }
- if (ZEND_IS_DIGIT(*e)) {
- goto process_double;
- }
+ if (*e == '-' || *e == '+') {
+ ptr = e++;
+ }
+ if (ZEND_IS_DIGIT(*e)) {
+ goto process_double;
}
}
break;
}
- if (base == 10) {
- if (digits >= MAX_LENGTH_OF_LONG) {
- if (oflow_info != NULL) {
- *oflow_info = *str == '-' ? -1 : 1;
- }
- dp_or_e = -1;
- goto process_double;
- }
- } else if (!(digits < SIZEOF_ZEND_LONG * 2 || (digits == SIZEOF_ZEND_LONG * 2 && ptr[-digits] <= '7'))) {
- if (dval) {
- local_dval = zend_hex_strtod(str, &ptr);
- }
+ if (digits >= MAX_LENGTH_OF_LONG) {
if (oflow_info != NULL) {
- *oflow_info = 1;
+ *oflow_info = *str == '-' ? -1 : 1;
}
- type = IS_DOUBLE;
+ dp_or_e = -1;
+ goto process_double;
}
} else if (*ptr == '.' && ZEND_IS_DIGIT(ptr[1])) {
process_double:
}
if (lval) {
- *lval = ZEND_STRTOL(str, NULL, base);
+ *lval = ZEND_STRTOL(str, NULL, 10);
}
return IS_LONG;
$key_compare_function = 'compare_function';
// Initialise all required variables
-$arr1 = array("one" => "one", "02" => "two", '3' => "three", "four", "0.5" => 5, 6.0 => 6, "seven" => "0x7");
+$arr1 = array("one" => "one", "02" => "two", '3' => "three", "four", "0.5" => 5, 6.0 => 6, "seven" => "07");
$arr2 = array("one" => "one", "02" => "two", '3' => "three");
$arr3 = array("four", "0.5" => "five", 6 => 6, "seven" => 7);
$arr4 = array("four", "0.5" => "five", 6 => 6, "seven" => 7);
' 1',
'2974394749328742328432',
'-1e-2',
- "0xff",
- '0xff',
"0123",
'0123',
"-0123",
// other types in a array
$not_numerics = array(
+ "0x80001",
"-0x80001",
"+0x80001",
"-0x80001.5",
bool(true)
-- Iteration 76 --
bool(true)
--- Iteration 77 --
-bool(true)
--- Iteration 78 --
-bool(true)
*** Testing is_numeric() on non numeric types ***
-- Iteration 1 --
bool(false)
-- Iteration 28 --
bool(false)
+-- Iteration 29 --
+bool(false)
*** Testing error conditions ***
"3.95E3",
"-3.95E3",
"039",
- "0x5F",
true,
false,
null,
float(3950)
float(-3950)
float(39)
-float(95)
float(1)
float(0)
float(0)
"3950.5",
"3.9505e3",
"039",
- "0x5F",
true,
false,
null,
float(8.6593400423994E+16)
-- Iteration 10 --
-float(1.811239082889E+41)
-
--- Iteration 11 --
float(2.718281828459)
--- Iteration 12 --
+-- Iteration 11 --
float(1)
--- Iteration 13 --
+-- Iteration 12 --
float(1)
-===Done===
\ No newline at end of file
+===Done===
"3950.5",
"3.9505e3",
"039",
- "0x5F",
true,
false,
null,
float(8.6593400423994E+16)
-- Iteration 10 --
-float(1.811239082889E+41)
-
--- Iteration 11 --
float(1.718281828459)
--- Iteration 12 --
+-- Iteration 11 --
float(0)
--- Iteration 13 --
+-- Iteration 12 --
float(0)
-===Done===
\ No newline at end of file
+===Done===
"3.95E3",
"-3.95E3",
"039",
- "0x5F",
true,
false,
null,
-- floor 039 --
float(39)
--- floor 0x5F --
-float(95)
-
-- floor 1 --
float(1)
-- floor --
float(0)
-===Done===
\ No newline at end of file
+===Done===
false,
null,
"10",
- "0x10",
"10.5");
-// Eexepcted numerical equivalent of above non-numerics
+// Expected numerical equivalent of above non-numerics
$minval = array(1,
0,
0,
10,
- 0,
10);
for ($x = 0; $x < count($min); $x++) {
for ($i = 0; $i < 100; $i++) {
PASSED range min = 0 max = 100
PASSED range min = 0 max = 100
PASSED range min = 10 max = 100
-PASSED range min = 0 max = 100
PASSED range min = 10 max = 100
false,
null,
"10",
- "0x10",
"10.5");
// Eexepcted numerical equivalent of above non-numerics
0,
0,
10,
- 0,
10);
for ($x = 0; $x < count($min); $x++) {
for ($i = 0; $i < 100; $i++) {
PASSED range min = 0 max = 100
PASSED range min = 0 max = 100
PASSED range min = 10 max = 100
-PASSED range min = 0 max = 100
PASSED range min = 10 max = 100
0x234567,
067777777,
"1.234567",
- "2.3456789e8",
- "0x1234CDEF");
+ "2.3456789e8");
$precision = array(2,
8,
04,
3.6,
"2",
- "0x03",
"04",
"3.6",
"2.1e1",
...with precision 4-> float(123456789)
...with precision 3.6-> float(123456789)
...with precision 2-> float(123456789)
-...with precision 0x03-> float(123456789)
...with precision 04-> float(123456789)
...with precision 3.6-> float(123456789)
...with precision 2.1e1-> float(123456789)
...with precision 4-> float(123.4568)
...with precision 3.6-> float(123.457)
...with precision 2-> float(123.46)
-...with precision 0x03-> float(123.457)
...with precision 04-> float(123.4568)
...with precision 3.6-> float(123.457)
...with precision 2.1e1-> float(123.456789)
...with precision 4-> float(-4.5679)
...with precision 3.6-> float(-4.568)
...with precision 2-> float(-4.57)
-...with precision 0x03-> float(-4.568)
...with precision 04-> float(-4.5679)
...with precision 3.6-> float(-4.568)
...with precision 2.1e1-> float(-4.5679123)
...with precision 4-> float(12300)
...with precision 3.6-> float(12300)
...with precision 2-> float(12300)
-...with precision 0x03-> float(12300)
...with precision 04-> float(12300)
...with precision 3.6-> float(12300)
...with precision 2.1e1-> float(12300)
...with precision 4-> float(-4567)
...with precision 3.6-> float(-4567)
...with precision 2-> float(-4567)
-...with precision 0x03-> float(-4567)
...with precision 04-> float(-4567)
...with precision 3.6-> float(-4567)
...with precision 2.1e1-> float(-4567)
...with precision 4-> float(2311527)
...with precision 3.6-> float(2311527)
...with precision 2-> float(2311527)
-...with precision 0x03-> float(2311527)
...with precision 04-> float(2311527)
...with precision 3.6-> float(2311527)
...with precision 2.1e1-> float(2311527)
...with precision 4-> float(14680063)
...with precision 3.6-> float(14680063)
...with precision 2-> float(14680063)
-...with precision 0x03-> float(14680063)
...with precision 04-> float(14680063)
...with precision 3.6-> float(14680063)
...with precision 2.1e1-> float(14680063)
...with precision 4-> float(1.2346)
...with precision 3.6-> float(1.235)
...with precision 2-> float(1.23)
-...with precision 0x03-> float(1.235)
...with precision 04-> float(1.2346)
...with precision 3.6-> float(1.235)
...with precision 2.1e1-> float(1.234567)
...with precision 4-> float(234567890)
...with precision 3.6-> float(234567890)
...with precision 2-> float(234567890)
-...with precision 0x03-> float(234567890)
...with precision 04-> float(234567890)
...with precision 3.6-> float(234567890)
...with precision 2.1e1-> float(234567890)
...with precision -> float(234567890)
...with precision 1-> float(234567890)
...with precision -> float(234567890)
-round: 0x1234CDEF
-...with precision 2-> float(305450479)
-...with precision 8-> float(305450479)
-...with precision 3-> float(305450479)
-...with precision 4-> float(305450479)
-...with precision 3.6-> float(305450479)
-...with precision 2-> float(305450479)
-...with precision 0x03-> float(305450479)
-...with precision 04-> float(305450479)
-...with precision 3.6-> float(305450479)
-...with precision 2.1e1-> float(305450479)
-...with precision -> float(305450479)
-...with precision 1-> float(305450479)
-...with precision -> float(305450479)
-===Done===
\ No newline at end of file
+===Done===
.The function tries to avoid breaking words
"
-- Iteration 23 --
-string(109) "textual vis
-to
-textrew Heb
-icallog
-ertsconvion unctf
-brevhe
-.Therds
-wo
-kingbreaoid av
-to
-riest
-tionfuncThe .
+
+Notice: A non well formed numeric value encountered in %s on line %d
+string(109) ".The hebrev function converts logical Hebrew text to visual text
+.The function tries to avoid breaking words
"
-- Iteration 24 --
string(109) ".The hebrev function converts logical Hebrew text to visual text
.The function tries to avoid breaking words
"
-===DONE===
\ No newline at end of file
+===DONE===
.The function tries to avoid breaking words<br />
"
-- Iteration 23 --
-string(349) "textual vis<br />
-to<br />
-textrew Heb<br />
-icallog<br />
-ertsconvion unctf<br />
-evcchebrThe .<br />
-inesnewlrts onvec<br />
-it<br />
-thatnce feredif<br />
-the<br />
-withc() brevhe<br />
-to<br />
-ilarsim<br />
-is<br />
-tionfunchis ) T<br />
-(<br />
-'<br<to .'<br />
-<br />
-ordsw<br />
-kingbreaoid av<br />
-to<br />
-riest<br />
-tionfuncThe .<br />
+
+Notice: A non well formed numeric value encountered in %s on line %d
+string(241) ".The hebrevcc function converts logical Hebrew text to visual text<br />
+) This function is similar to hebrevc() with the difference that it converts newlines<br />
+<to '<br (<br />
+.'<br />
+.The function tries to avoid breaking words<br />
"
-- Iteration 24 --
Warning: money_format() expects parameter 2 to be float, string given in %s on line %d
NULL
-- Iteration 21 --
+
+Notice: A non well formed numeric value encountered in %s on line %d
string
-- Iteration 22 --
-- Iteration 12 --
string(20) "****Test string*****"
-- Iteration 13 --
-string(20) "****Test string*****"
+
+Notice: A non well formed numeric value encountered in %s on line %d
+string(20) "*********Test string"
-- Iteration 14 --
string(20) "****Test string*****"
-- Iteration 15 --