. Added support for negative string offsets in string offset syntax and
various string functions. (Francois)
. Added a form of the list() construct where keys can be specified. (Andrea)
+ . Number operators taking numeric strings now emit E_NOTICEs or E_WARNINGs
+ when given malformed numeric strings. (Andrea)
+ . (int), intval() where $base is 10 or unspecified, settype(), integer
+ operators and other conversions now always respect scientific notation in
+ numeric strings. (Andrea)
- FTP:
. Implemented FR #55651 (Option to ignore the returned FTP PASV address).
- Core:
. 'void' can no longer be used as the name of a class, interface, or trait.
This applies to declarations, class_alias() and use statements.
+ . (int), intval() where $base is 10 or unspecified, settype(), integer
+ operators and other conversions now always respect scientific notation in
+ numeric strings.
+ (RFC: https://wiki.php.net/rfc/invalid_strings_in_arithmetic)
- JSON:
. When calling json_encode with JSON_UNESCAPED_UNICODE option, U+2028 and
(RFC: https://wiki.php.net/rfc/negative-string-offsets)
. Added a form of the list() construct where keys can be specified.
(RFC: https://wiki.php.net/rfc/list_keys)
+ . Number operators taking numeric strings now emit "A non well formed numeric
+ string encountered" E_NOTICEs for leading-numeric strings, and "A
+ non-numeric string encountered" E_WARNINGs for non-numeric strings.
+ (RFC: https://wiki.php.net/rfc/invalid_strings_in_arithmetic)
========================================
3. Changes in SAPI modules
echo "Done\n";
?>
--EXPECTF--
+
+Warning: A non-numeric value encountered in %s on line %d
int(75636)
+
+Notice: A non well formed numeric value encountered in %s on line %d
int(951858)
int(48550510)
float(75661.68)
+
+Warning: A non-numeric value encountered in %s on line %d
int(75636)
+
+Notice: A non well formed numeric value encountered in %s on line %d
int(951858)
int(48550510)
float(75661.68)
echo "Done\n";
?>
--EXPECTF--
+
+Warning: A non-numeric value encountered in %s on line %d
+
Exception: Unsupported operand types
+Warning: A non-numeric value encountered in %s on line %d
+
Fatal error: Uncaught Error: Unsupported operand types in %s:%d
Stack trace:
#0 {main}
);
?>
---EXPECT--
+--EXPECTF--
+
+Warning: A non-numeric value encountered in %s on line %d
int(3)
string(4) "1foo"
bool(false)
--- /dev/null
+--TEST--
+Integer conversion from scientific notation
+--FILE--
+<?php
+
+var_dump((int)"1.2345e9");
+var_dump((int)"-1.2345e9");
+var_dump(intval("1.2345e9"));
+var_dump(intval("-1.2345e9"));
+var_dump("1.2345e9" % PHP_INT_MAX);
+var_dump("-1.2345e9" % PHP_INT_MIN);
+var_dump("1.2345e9" | 0);
+var_dump("-1.2345e9" | 0);
+
+echo PHP_EOL;
+
+var_dump((int)" 1.2345e9 abc");
+var_dump((int)" -1.2345e9 abc");
+var_dump(intval(" 1.2345e9 abc"));
+var_dump(intval(" -1.2345e9 abc"));
+var_dump(" 1.2345e9 abc" % PHP_INT_MAX);
+var_dump(" -1.2345e9 abc" % PHP_INT_MIN);
+var_dump(" 1.2345e9 abc" | 0);
+var_dump(" -1.2345e9 abc" | 0);
+
+?>
+--EXPECTF--
+int(1234500000)
+int(-1234500000)
+int(1234500000)
+int(-1234500000)
+int(1234500000)
+int(-1234500000)
+int(1234500000)
+int(-1234500000)
+
+int(1234500000)
+int(-1234500000)
+int(1234500000)
+int(-1234500000)
+
+Notice: A non well formed numeric value encountered in %s on line %d
+int(1234500000)
+
+Notice: A non well formed numeric value encountered in %s on line %d
+int(-1234500000)
+
+Notice: A non well formed numeric value encountered in %s on line %d
+int(1234500000)
+
+Notice: A non well formed numeric value encountered in %s on line %d
+int(-1234500000)
--- /dev/null
+--TEST--
+Invalid numeric string E_WARNINGs and E_NOTICEs
+--FILE--
+<?php
+
+var_dump("2 Lorem" + "3 ipsum");
+var_dump("dolor" + "sit");
+echo "---", PHP_EOL;
+var_dump("5 amet," - "7 consectetur");
+var_dump("adipiscing" - "elit,");
+echo "---", PHP_EOL;
+var_dump("11 sed" * "13 do");
+var_dump("eiusmod" * "tempor");
+echo "---", PHP_EOL;
+var_dump("17 incididunt" / "19 ut");
+var_dump("labore" / "et");
+echo "---", PHP_EOL;
+var_dump("23 dolore" ** "29 magna");
+var_dump("aliqua." ** "Ut");
+echo "---", PHP_EOL;
+var_dump("31 enim" % "37 ad");
+try {
+ var_dump("minim" % "veniam,");
+} catch (DivisionByZeroError $e) {
+}
+echo "---", PHP_EOL;
+var_dump("41 minim" << "43 veniam,");
+var_dump("quis" << "nostrud");
+echo "---", PHP_EOL;
+var_dump("47 exercitation" >> "53 ullamco");
+var_dump("laboris" >> "nisi");
+echo "---", PHP_EOL;
+var_dump("59 ut" | 61);
+var_dump(67 | "71 aliquip");
+var_dump("ex" | 73);
+var_dump(79 | "ea");
+echo "---", PHP_EOL;
+var_dump("83 commodo" & 89);
+var_dump(97 & "101 consequat.");
+var_dump("Duis" & 103);
+var_dump(107 & "aute");
+echo "---", PHP_EOL;
+var_dump("109 irure" ^ 113);
+var_dump(127 ^ "131 dolor");
+var_dump("in" ^ 137);
+var_dump(139 ^ "reprehenderit");
+echo "---", PHP_EOL;
+var_dump(+"149 in");
+var_dump(+"voluptate");
+echo "---", PHP_EOL;
+var_dump(-"151 velit");
+var_dump(-"esse");
+?>
+--EXPECTF--
+
+Notice: A non well formed numeric value encountered in %s on line %d
+
+Notice: A non well formed numeric value encountered in %s on line %d
+int(5)
+
+Warning: A non-numeric value encountered in %s on line %d
+
+Warning: A non-numeric value encountered in %s on line %d
+int(0)
+---
+
+Notice: A non well formed numeric value encountered in %s on line %d
+
+Notice: A non well formed numeric value encountered in %s on line %d
+int(-2)
+
+Warning: A non-numeric value encountered in %s on line %d
+
+Warning: A non-numeric value encountered in %s on line %d
+int(0)
+---
+
+Notice: A non well formed numeric value encountered in %s on line %d
+
+Notice: A non well formed numeric value encountered in %s on line %d
+int(143)
+
+Warning: A non-numeric value encountered in %s on line %d
+
+Warning: A non-numeric value encountered in %s on line %d
+int(0)
+---
+
+Notice: A non well formed numeric value encountered in %s on line %d
+
+Notice: A non well formed numeric value encountered in %s on line %d
+float(0.89473684210526)
+
+Warning: A non-numeric value encountered in %s on line %d
+
+Warning: A non-numeric value encountered in %s on line %d
+
+Warning: Division by zero in %s on line %d
+float(NAN)
+---
+
+Notice: A non well formed numeric value encountered in %s on line %d
+
+Notice: A non well formed numeric value encountered in %s on line %d
+float(3.0910586430935E+39)
+
+Warning: A non-numeric value encountered in %s on line %d
+
+Warning: A non-numeric value encountered in %s on line %d
+int(1)
+---
+
+Notice: A non well formed numeric value encountered in %s on line %d
+
+Notice: A non well formed numeric value encountered in %s on line %d
+int(31)
+
+Warning: A non-numeric value encountered in %s on line %d
+
+Warning: A non-numeric value encountered in %s on line %d
+---
+
+Notice: A non well formed numeric value encountered in %s on line %d
+
+Notice: A non well formed numeric value encountered in %s on line %d
+int(360639813910528)
+
+Warning: A non-numeric value encountered in %s on line %d
+
+Warning: A non-numeric value encountered in %s on line %d
+int(0)
+---
+
+Notice: A non well formed numeric value encountered in %s on line %d
+
+Notice: A non well formed numeric value encountered in %s on line %d
+int(0)
+
+Warning: A non-numeric value encountered in %s on line %d
+
+Warning: A non-numeric value encountered in %s on line %d
+int(0)
+---
+
+Notice: A non well formed numeric value encountered in %s on line %d
+int(63)
+
+Notice: A non well formed numeric value encountered in %s on line %d
+int(71)
+
+Warning: A non-numeric value encountered in %s on line %d
+int(73)
+
+Warning: A non-numeric value encountered in %s on line %d
+int(79)
+---
+
+Notice: A non well formed numeric value encountered in %s on line %d
+int(81)
+
+Notice: A non well formed numeric value encountered in %s on line %d
+int(97)
+
+Warning: A non-numeric value encountered in %s on line %d
+int(0)
+
+Warning: A non-numeric value encountered in %s on line %d
+int(0)
+---
+
+Notice: A non well formed numeric value encountered in %s on line %d
+int(28)
+
+Notice: A non well formed numeric value encountered in %s on line %d
+int(252)
+
+Warning: A non-numeric value encountered in %s on line %d
+int(137)
+
+Warning: A non-numeric value encountered in %s on line %d
+int(139)
+---
+
+Notice: A non well formed numeric value encountered in %s on line %d
+int(149)
+
+Warning: A non-numeric value encountered in %s on line %d
+int(0)
+---
+
+Notice: A non well formed numeric value encountered in %s on line %d
+int(-151)
+
+Warning: A non-numeric value encountered in %s on line %d
+int(0)
--- /dev/null
+--TEST--
+Invalid numeric string E_WARNINGs and E_NOTICEs, combined assignment operations
+--FILE--
+<?php
+
+// prevents CT eval
+function foxcache($val) {
+ return [$val][0];
+}
+
+$a = foxcache("2 Lorem");
+$a += "3 ipsum";
+var_dump($a);
+$a = foxcache("dolor");
+$a += "sit";
+var_dump($a);
+echo "---", PHP_EOL;
+$a = foxcache("5 amet,");
+$a -= "7 consectetur";
+var_dump($a);
+$a = foxcache("adipiscing");
+$a -= "elit,";
+var_dump($a);
+echo "---", PHP_EOL;
+$a = foxcache("11 sed");
+$a *= "13 do";
+var_dump($a);
+$a = foxcache("eiusmod");
+$a *= "tempor";
+var_dump($a);
+echo "---", PHP_EOL;
+$a = foxcache("17 incididunt");
+$a /= "19 ut";
+var_dump($a);
+$a = foxcache("labore");
+$a /= "et";
+var_dump($a);
+echo "---", PHP_EOL;
+$a = foxcache("23 dolore");
+$a **= "29 magna";
+var_dump($a);
+$a = foxcache("aliqua.");
+$a **= "Ut";
+var_dump($a);
+echo "---", PHP_EOL;
+$a = foxcache("31 enim");
+$a %= "37 ad";
+var_dump($a);
+try {
+ $a = foxcache("minim");
+ $a %= "veniam,";
+ var_dump($a);
+} catch (DivisionByZeroError $e) {
+}
+echo "---", PHP_EOL;
+$a = foxcache("41 minim");
+$a <<= "43 veniam,";
+var_dump($a);
+$a = foxcache("quis");
+$a <<= "nostrud";
+var_dump($a);
+echo "---", PHP_EOL;
+$a = foxcache("47 exercitation");
+$a >>= "53 ullamco";
+var_dump($a);
+$a = foxcache("laboris");
+$a >>= "nisi";
+var_dump($a);
+echo "---", PHP_EOL;
+$a = foxcache("59 ut");
+$a |= 61;
+var_dump($a);
+$a = foxcache(67);
+$a |= "71 aliquip";
+var_dump($a);
+$a = foxcache("ex");
+$a |= 73;
+var_dump($a);
+$a = foxcache(79);
+$a |= "ea";
+var_dump($a);
+echo "---", PHP_EOL;
+$a = foxcache("83 commodo");
+$a &= 89;
+var_dump($a);
+$a = foxcache(97);
+$a &= "101 consequat.";
+var_dump($a);
+$a = foxcache("Duis");
+$a &= 103;
+var_dump($a);
+$a = foxcache(107);
+$a &= "aute";
+var_dump($a);
+echo "---", PHP_EOL;
+$a = foxcache("109 irure");
+$a ^= 113;
+var_dump($a);
+$a = foxcache(127);
+$a ^= "131 dolor";
+var_dump($a);
+$a = foxcache("in");
+$a ^= 137;
+var_dump($a);
+$a = foxcache(139);
+$a ^= "reprehenderit";
+var_dump($a);
+?>
+--EXPECTF--
+
+Notice: A non well formed numeric value encountered in %s on line %d
+
+Notice: A non well formed numeric value encountered in %s on line %d
+int(5)
+
+Warning: A non-numeric value encountered in %s on line %d
+
+Warning: A non-numeric value encountered in %s on line %d
+int(0)
+---
+
+Notice: A non well formed numeric value encountered in %s on line %d
+
+Notice: A non well formed numeric value encountered in %s on line %d
+int(-2)
+
+Warning: A non-numeric value encountered in %s on line %d
+
+Warning: A non-numeric value encountered in %s on line %d
+int(0)
+---
+
+Notice: A non well formed numeric value encountered in %s on line %d
+
+Notice: A non well formed numeric value encountered in %s on line %d
+int(143)
+
+Warning: A non-numeric value encountered in %s on line %d
+
+Warning: A non-numeric value encountered in %s on line %d
+int(0)
+---
+
+Notice: A non well formed numeric value encountered in %s on line %d
+
+Notice: A non well formed numeric value encountered in %s on line %d
+float(0.89473684210526)
+
+Warning: A non-numeric value encountered in %s on line %d
+
+Warning: A non-numeric value encountered in %s on line %d
+
+Warning: Division by zero in %s on line %d
+float(NAN)
+---
+
+Notice: A non well formed numeric value encountered in %s on line %d
+
+Notice: A non well formed numeric value encountered in %s on line %d
+float(3.0910586430935E+39)
+
+Warning: A non-numeric value encountered in %s on line %d
+
+Warning: A non-numeric value encountered in %s on line %d
+int(1)
+---
+
+Notice: A non well formed numeric value encountered in %s on line %d
+
+Notice: A non well formed numeric value encountered in %s on line %d
+int(31)
+
+Warning: A non-numeric value encountered in %s on line %d
+
+Warning: A non-numeric value encountered in %s on line %d
+---
+
+Notice: A non well formed numeric value encountered in %s on line %d
+
+Notice: A non well formed numeric value encountered in %s on line %d
+int(360639813910528)
+
+Warning: A non-numeric value encountered in %s on line %d
+
+Warning: A non-numeric value encountered in %s on line %d
+int(0)
+---
+
+Notice: A non well formed numeric value encountered in %s on line %d
+
+Notice: A non well formed numeric value encountered in %s on line %d
+int(0)
+
+Warning: A non-numeric value encountered in %s on line %d
+
+Warning: A non-numeric value encountered in %s on line %d
+int(0)
+---
+
+Notice: A non well formed numeric value encountered in %s on line %d
+int(63)
+
+Notice: A non well formed numeric value encountered in %s on line %d
+int(71)
+
+Warning: A non-numeric value encountered in %s on line %d
+int(73)
+
+Warning: A non-numeric value encountered in %s on line %d
+int(79)
+---
+
+Notice: A non well formed numeric value encountered in %s on line %d
+int(81)
+
+Notice: A non well formed numeric value encountered in %s on line %d
+int(97)
+
+Warning: A non-numeric value encountered in %s on line %d
+int(0)
+
+Warning: A non-numeric value encountered in %s on line %d
+int(0)
+---
+
+Notice: A non well formed numeric value encountered in %s on line %d
+int(28)
+
+Notice: A non well formed numeric value encountered in %s on line %d
+int(252)
+
+Warning: A non-numeric value encountered in %s on line %d
+int(137)
+
+Warning: A non-numeric value encountered in %s on line %d
+int(139)
?>
--EXPECTF--
int(18)
+
+Warning: A non-numeric value encountered in %s on line %d
int(0)
+
+Notice: A non well formed numeric value encountered in %s on line %d
int(33)
Done
?>
--EXPECTF--
int(13)
+
+Warning: A non-numeric value encountered in %s on line %d
int(0)
+
+Notice: A non well formed numeric value encountered in %s on line %d
int(3)
Done
?>
--EXPECTF--
int(127)
+
+Warning: A non-numeric value encountered in %s on line %d
int(11)
+
+Notice: A non well formed numeric value encountered in %s on line %d
int(45345)
Done
?>
--EXPECTF--
int(109)
+
+Warning: A non-numeric value encountered in %s on line %d
int(11)
+
+Notice: A non well formed numeric value encountered in %s on line %d
int(45312)
Done
?>
--EXPECTF--
int(492)
+
+Warning: A non-numeric value encountered in %s on line %d
int(0)
+
+Notice: A non well formed numeric value encountered in %s on line %d
int(362760)
Done
?>
--EXPECTF--
int(30)
+
+Warning: A non-numeric value encountered in %s on line %d
int(0)
+
+Notice: A non well formed numeric value encountered in %s on line %d
int(5668)
Done
if (UNEXPECTED(zend_isnan(Z_DVAL_P(arg)))) {
return 0;
}
- if (UNEXPECTED(!ZEND_DOUBLE_FITS_LONG(Z_DVAL_P(arg)))) {
- *dest = (Z_DVAL_P(arg) > 0) ? ZEND_LONG_MAX : ZEND_LONG_MIN;
- } else {
- *dest = zend_dval_to_lval(Z_DVAL_P(arg));
- }
+ *dest = zend_dval_to_lval_cap(Z_DVAL_P(arg));
} else if (EXPECTED(Z_TYPE_P(arg) == IS_STRING)) {
double d;
int type;
if (UNEXPECTED(zend_isnan(d))) {
return 0;
}
- if (UNEXPECTED(!ZEND_DOUBLE_FITS_LONG(d))) {
- *dest = (d > 0) ? ZEND_LONG_MAX : ZEND_LONG_MIN;
- } else {
- *dest = zend_dval_to_lval(d);
- }
+ *dest = zend_dval_to_lval_cap(d);
} else {
return 0;
}
}
/* }}} */
+ZEND_API zend_bool zend_binary_op_produces_numeric_string_error(uint32_t opcode, zval *op1, zval *op2) /* {{{ */
+{
+ if (!(opcode == ZEND_ADD || opcode == ZEND_SUB || opcode == ZEND_MUL || opcode == ZEND_DIV
+ || opcode == ZEND_POW || opcode == ZEND_MOD || opcode == ZEND_SL || opcode == ZEND_SR
+ || opcode == ZEND_BW_OR || opcode == ZEND_BW_AND || opcode == ZEND_BW_XOR)) {
+ return 0;
+ }
+
+ /* While basic arithmetic operators always produce numeric string errors,
+ * bitwise operators don't produce errors if both operands are strings */
+ if ((opcode == ZEND_BW_OR || opcode == ZEND_BW_AND || opcode == ZEND_BW_XOR)
+ && Z_TYPE_P(op1) == IS_STRING && Z_TYPE_P(op2) == IS_STRING) {
+ return 0;
+ }
+
+ if (Z_TYPE_P(op1) == IS_STRING
+ && !is_numeric_string(Z_STRVAL_P(op1), Z_STRLEN_P(op1), NULL, NULL, 0)) {
+ return 1;
+ }
+
+ if (Z_TYPE_P(op2) == IS_STRING
+ && !is_numeric_string(Z_STRVAL_P(op2), Z_STRLEN_P(op2), NULL, NULL, 0)) {
+ return 1;
+ }
+
+ return 0;
+}
+/* }}} */
+
static inline zend_bool zend_try_ct_eval_binary_op(zval *result, uint32_t opcode, zval *op1, zval *op2) /* {{{ */
{
binary_op_type fn = get_binary_op(opcode);
return 0;
}
+ /* don't evaluate numeric string error-producing operations at compile-time */
+ if (zend_binary_op_produces_numeric_string_error(opcode, op1, op2)) {
+ return 0;
+ }
+
fn(result, op1, op2);
return 1;
}
}
/* }}} */
-static inline void zend_ct_eval_unary_pm(zval *result, zend_ast_kind kind, zval *op) /* {{{ */
+static inline zend_bool zend_try_ct_eval_unary_pm(zval *result, zend_ast_kind kind, zval *op) /* {{{ */
{
zval left;
ZVAL_LONG(&left, (kind == ZEND_AST_UNARY_PLUS) ? 1 : -1);
- mul_function(result, &left, op);
+ return zend_try_ct_eval_binary_op(result, ZEND_MUL, &left, op);
}
/* }}} */
zend_compile_expr(&expr_node, expr_ast);
if (expr_node.op_type == IS_CONST) {
- result->op_type = IS_CONST;
- zend_ct_eval_unary_pm(&result->u.constant, ast->kind, &expr_node.u.constant);
- zval_ptr_dtor(&expr_node.u.constant);
- return;
+ if (zend_try_ct_eval_unary_pm(&result->u.constant, ast->kind, &expr_node.u.constant)) {
+ result->op_type = IS_CONST;
+ zval_ptr_dtor(&expr_node.u.constant);
+ return;
+ }
}
lefthand_node.op_type = IS_CONST;
return;
}
- zend_ct_eval_unary_pm(&result, ast->kind, zend_ast_get_zval(ast->child[0]));
+ if (!zend_try_ct_eval_unary_pm(&result, ast->kind, zend_ast_get_zval(ast->child[0]))) {
+ return;
+ }
break;
case ZEND_AST_CONDITIONAL:
{
/* The default value for CG(compiler_options) during eval() */
#define ZEND_COMPILE_DEFAULT_FOR_EVAL 0
+ZEND_API zend_bool zend_binary_op_produces_numeric_string_error(uint32_t opcode, zval *op1, zval *op2);
+
#endif /* ZEND_COMPILE_H */
/*
}
/* }}} */
-ZEND_API void ZEND_FASTCALL convert_scalar_to_number(zval *op) /* {{{ */
+void ZEND_FASTCALL _convert_scalar_to_number(zval *op, zend_bool silent) /* {{{ */
{
try_again:
switch (Z_TYPE_P(op)) {
zend_string *str;
str = Z_STR_P(op);
- if ((Z_TYPE_INFO_P(op)=is_numeric_string(ZSTR_VAL(str), ZSTR_LEN(str), &Z_LVAL_P(op), &Z_DVAL_P(op), 1)) == 0) {
+ if ((Z_TYPE_INFO_P(op)=is_numeric_string(ZSTR_VAL(str), ZSTR_LEN(str), &Z_LVAL_P(op), &Z_DVAL_P(op), silent ? 1 : -1)) == 0) {
ZVAL_LONG(op, 0);
+ if (!silent) {
+ zend_error(E_WARNING, "A non-numeric value encountered");
+ }
}
zend_string_release(str);
break;
}
/* }}} */
+ZEND_API void ZEND_FASTCALL convert_scalar_to_number(zval *op) /* {{{ */
+{
+ _convert_scalar_to_number(op, 1);
+}
+/* }}} */
+
/* {{{ zendi_convert_scalar_to_number */
-#define zendi_convert_scalar_to_number(op, holder, result) \
+#define zendi_convert_scalar_to_number(op, holder, result, silent) \
if (op==result) { \
if (Z_TYPE_P(op) != IS_LONG) { \
- convert_scalar_to_number(op); \
+ _convert_scalar_to_number(op, silent); \
} \
} else { \
switch (Z_TYPE_P(op)) { \
case IS_STRING: \
{ \
- if ((Z_TYPE_INFO(holder)=is_numeric_string(Z_STRVAL_P(op), Z_STRLEN_P(op), &Z_LVAL(holder), &Z_DVAL(holder), 1)) == 0) { \
+ if ((Z_TYPE_INFO(holder)=is_numeric_string(Z_STRVAL_P(op), Z_STRLEN_P(op), &Z_LVAL(holder), &Z_DVAL(holder), silent ? 1 : -1)) == 0) { \
ZVAL_LONG(&(holder), 0); \
+ if (!silent) { \
+ zend_error(E_WARNING, "A non-numeric value encountered"); \
+ } \
} \
(op) = &(holder); \
break; \
} \
} \
ZEND_TRY_BINARY_OP1_OBJECT_OPERATION(op, op_func); \
- op1_lval = _zval_get_long_func(op1); \
+ op1_lval = _zval_get_long_func_noisy(op1); \
} else { \
op1_lval = Z_LVAL_P(op1); \
} \
} \
} \
ZEND_TRY_BINARY_OP2_OBJECT_OPERATION(op); \
- op2_lval = _zval_get_long_func(op2); \
+ op2_lval = _zval_get_long_func_noisy(op2); \
} else { \
op2_lval = Z_LVAL_P(op2); \
} \
case IS_STRING:
{
zend_string *str = Z_STR_P(op);
-
- ZVAL_LONG(op, ZEND_STRTOL(ZSTR_VAL(str), NULL, base));
+ if (base == 10) {
+ ZVAL_LONG(op, zval_get_long(op));
+ } else {
+ ZVAL_LONG(op, ZEND_STRTOL(ZSTR_VAL(str), NULL, base));
+ }
zend_string_release(str);
}
break;
}
/* }}} */
-ZEND_API zend_long ZEND_FASTCALL _zval_get_long_func(zval *op) /* {{{ */
+static zend_always_inline zend_long ZEND_FASTCALL _zval_get_long_func_ex(zval *op, zend_bool silent) /* {{{ */
{
try_again:
switch (Z_TYPE_P(op)) {
case IS_DOUBLE:
return zend_dval_to_lval(Z_DVAL_P(op));
case IS_STRING:
- return ZEND_STRTOL(Z_STRVAL_P(op), NULL, 10);
+ {
+ zend_uchar type;
+ zend_long lval;
+ double dval;
+ if (0 == (type = is_numeric_string(Z_STRVAL_P(op), Z_STRLEN_P(op), &lval, &dval, silent ? 1 : -1))) {
+ if (!silent) {
+ zend_error(E_WARNING, "A non-numeric value encountered");
+ }
+ return 0;
+ } else if (EXPECTED(type == IS_LONG)) {
+ return lval;
+ } else {
+ /* Previously we used strtol here, not is_numeric_string,
+ * and strtol gives you LONG_MAX/_MIN on overflow.
+ * We use use saturating conversion to emulate strtol()'s
+ * behaviour.
+ */
+ return zend_dval_to_lval_cap(dval);
+ }
+ }
case IS_ARRAY:
return zend_hash_num_elements(Z_ARRVAL_P(op)) ? 1 : 0;
case IS_OBJECT:
}
/* }}} */
+ZEND_API zend_long ZEND_FASTCALL _zval_get_long_func(zval *op) /* {{{ */
+{
+ return _zval_get_long_func_ex(op, 1);
+}
+/* }}} */
+
+static zend_long ZEND_FASTCALL _zval_get_long_func_noisy(zval *op) /* {{{ */
+{
+ return _zval_get_long_func_ex(op, 0);
+}
+/* }}} */
+
ZEND_API double ZEND_FASTCALL _zval_get_double_func(zval *op) /* {{{ */
{
try_again:
} else if (!converted) {
ZEND_TRY_BINARY_OBJECT_OPERATION(ZEND_ADD, add_function);
- zendi_convert_scalar_to_number(op1, op1_copy, result);
- zendi_convert_scalar_to_number(op2, op2_copy, result);
+ zendi_convert_scalar_to_number(op1, op1_copy, result, 0);
+ zendi_convert_scalar_to_number(op2, op2_copy, result, 0);
converted = 1;
} else {
zend_throw_error(NULL, "Unsupported operand types");
} else if (!converted) {
ZEND_TRY_BINARY_OBJECT_OPERATION(ZEND_SUB, sub_function);
- zendi_convert_scalar_to_number(op1, op1_copy, result);
- zendi_convert_scalar_to_number(op2, op2_copy, result);
+ zendi_convert_scalar_to_number(op1, op1_copy, result, 0);
+ zendi_convert_scalar_to_number(op2, op2_copy, result, 0);
converted = 1;
} else {
zend_throw_error(NULL, "Unsupported operand types");
} else if (!converted) {
ZEND_TRY_BINARY_OBJECT_OPERATION(ZEND_MUL, mul_function);
- zendi_convert_scalar_to_number(op1, op1_copy, result);
- zendi_convert_scalar_to_number(op2, op2_copy, result);
+ zendi_convert_scalar_to_number(op1, op1_copy, result, 0);
+ zendi_convert_scalar_to_number(op2, op2_copy, result, 0);
converted = 1;
} else {
zend_throw_error(NULL, "Unsupported operand types");
ZVAL_LONG(result, 0);
return SUCCESS;
} else {
- zendi_convert_scalar_to_number(op1, op1_copy, result);
+ zendi_convert_scalar_to_number(op1, op1_copy, result, 0);
}
if (Z_TYPE_P(op2) == IS_ARRAY) {
ZVAL_LONG(result, 1L);
return SUCCESS;
} else {
- zendi_convert_scalar_to_number(op2, op2_copy, result);
+ zendi_convert_scalar_to_number(op2, op2_copy, result, 0);
}
converted = 1;
} else {
} else if (!converted) {
ZEND_TRY_BINARY_OBJECT_OPERATION(ZEND_DIV, div_function);
- zendi_convert_scalar_to_number(op1, op1_copy, result);
- zendi_convert_scalar_to_number(op2, op2_copy, result);
+ zendi_convert_scalar_to_number(op1, op1_copy, result, 0);
+ zendi_convert_scalar_to_number(op2, op2_copy, result, 0);
converted = 1;
} else {
zend_throw_error(NULL, "Unsupported operand types");
if (UNEXPECTED(Z_TYPE_P(op1) != IS_LONG)) {
ZEND_TRY_BINARY_OP1_OBJECT_OPERATION(ZEND_BW_OR, bitwise_or_function);
- op1_lval = _zval_get_long_func(op1);
+ op1_lval = _zval_get_long_func_noisy(op1);
} else {
op1_lval = Z_LVAL_P(op1);
}
if (UNEXPECTED(Z_TYPE_P(op2) != IS_LONG)) {
ZEND_TRY_BINARY_OP2_OBJECT_OPERATION(ZEND_BW_OR);
- op2_lval = _zval_get_long_func(op2);
+ op2_lval = _zval_get_long_func_noisy(op2);
} else {
op2_lval = Z_LVAL_P(op2);
}
if (UNEXPECTED(Z_TYPE_P(op1) != IS_LONG)) {
ZEND_TRY_BINARY_OP1_OBJECT_OPERATION(ZEND_BW_AND, bitwise_and_function);
- op1_lval = _zval_get_long_func(op1);
+ op1_lval = _zval_get_long_func_noisy(op1);
} else {
op1_lval = Z_LVAL_P(op1);
}
if (UNEXPECTED(Z_TYPE_P(op2) != IS_LONG)) {
ZEND_TRY_BINARY_OP2_OBJECT_OPERATION(ZEND_BW_AND);
- op2_lval = _zval_get_long_func(op2);
+ op2_lval = _zval_get_long_func_noisy(op2);
} else {
op2_lval = Z_LVAL_P(op2);
}
if (UNEXPECTED(Z_TYPE_P(op1) != IS_LONG)) {
ZEND_TRY_BINARY_OP1_OBJECT_OPERATION(ZEND_BW_XOR, bitwise_xor_function);
- op1_lval = _zval_get_long_func(op1);
+ op1_lval = _zval_get_long_func_noisy(op1);
} else {
op1_lval = Z_LVAL_P(op1);
}
if (UNEXPECTED(Z_TYPE_P(op2) != IS_LONG)) {
ZEND_TRY_BINARY_OP2_OBJECT_OPERATION(ZEND_BW_XOR);
- op2_lval = _zval_get_long_func(op2);
+ op2_lval = _zval_get_long_func_noisy(op2);
} else {
op2_lval = Z_LVAL_P(op2);
}
ZVAL_LONG(result, zval_is_true(op1) ? 0 : -1);
return SUCCESS;
} else {
- zendi_convert_scalar_to_number(op1, op1_copy, result);
- zendi_convert_scalar_to_number(op2, op2_copy, result);
+ zendi_convert_scalar_to_number(op1, op1_copy, result, 1);
+ zendi_convert_scalar_to_number(op2, op2_copy, result, 1);
converted = 1;
}
} else if (Z_TYPE_P(op1)==IS_ARRAY) {
return (zend_long)d;
}
#endif
+
+static zend_always_inline zend_long zend_dval_to_lval_cap(double d)
+{
+ if (UNEXPECTED(!zend_finite(d)) || UNEXPECTED(zend_isnan(d))) {
+ return 0;
+ } else if (!ZEND_DOUBLE_FITS_LONG(d)) {
+ return (d > 0 ? ZEND_LONG_MAX : ZEND_LONG_MIN);
+ }
+ return (zend_long)d;
+}
/* }}} */
#define ZEND_IS_DIGIT(c) ((c) >= '0' && (c) <= '9')
} else if ((opline->opcode == ZEND_SL || opline->opcode == ZEND_SR) &&
zval_get_long(&ZEND_OP2_LITERAL(opline)) < 0) {
SET_VAR_SOURCE(opline);
+ opline++;
+ continue;
+ } else if (zend_binary_op_produces_numeric_string_error(opline->opcode, &ZEND_OP1_LITERAL(opline), &ZEND_OP2_LITERAL(opline))) {
+ SET_VAR_SOURCE(opline);
opline++;
continue;
}
+ printf("%d\n", opline->opcode);
er = EG(error_reporting);
EG(error_reporting) = 0;
if (binary_op(&result, &ZEND_OP1_LITERAL(opline), &ZEND_OP2_LITERAL(opline)) == SUCCESS) {
zval_get_long(&ZEND_OP2_LITERAL(opline)) < 0) {
/* shift by negative number */
break;
+ } else if (zend_binary_op_produces_numeric_string_error(opline->opcode, &ZEND_OP1_LITERAL(opline), &ZEND_OP2_LITERAL(opline))) {
+ /* produces numeric string E_NOTICE/E_WARNING */
+ break;
}
er = EG(error_reporting);
EG(error_reporting) = 0;
case ZEND_POW:
if (ZEND_OP1_TYPE(opline) == IS_CONST) {
if (Z_TYPE(ZEND_OP1_LITERAL(opline)) == IS_STRING) {
- convert_scalar_to_number(&ZEND_OP1_LITERAL(opline));
+ /* don't optimise if it should produce a runtime numeric string error */
+ if (is_numeric_string(Z_STRVAL(ZEND_OP1_LITERAL(opline)), Z_STRLEN(ZEND_OP1_LITERAL(opline)), NULL, NULL, 0)) {
+ convert_scalar_to_number(&ZEND_OP1_LITERAL(opline));
+ }
}
}
/* break missing *intentionally* - the assign_op's may only optimize op2 */
}
if (ZEND_OP2_TYPE(opline) == IS_CONST) {
if (Z_TYPE(ZEND_OP2_LITERAL(opline)) == IS_STRING) {
- convert_scalar_to_number(&ZEND_OP2_LITERAL(opline));
+ /* don't optimise if it should produce a runtime numeric string error */
+ if (is_numeric_string(Z_STRVAL(ZEND_OP2_LITERAL(opline)), Z_STRLEN(ZEND_OP2_LITERAL(opline)), NULL, NULL, 0)) {
+ convert_scalar_to_number(&ZEND_OP2_LITERAL(opline));
+ }
}
}
break;
case ZEND_SR:
if (ZEND_OP1_TYPE(opline) == IS_CONST) {
if (Z_TYPE(ZEND_OP1_LITERAL(opline)) != IS_LONG) {
- convert_to_long(&ZEND_OP1_LITERAL(opline));
+ /* don't optimise if it should produce a runtime numeric string error */
+ if (!(Z_TYPE(ZEND_OP1_LITERAL(opline)) == IS_STRING
+ && !is_numeric_string(Z_STRVAL(ZEND_OP1_LITERAL(opline)), Z_STRLEN(ZEND_OP1_LITERAL(opline)), NULL, NULL, 0))) {
+ convert_to_long(&ZEND_OP1_LITERAL(opline));
+ }
}
}
/* break missing *intentionally - the assign_op's may only optimize op2 */
}
if (ZEND_OP2_TYPE(opline) == IS_CONST) {
if (Z_TYPE(ZEND_OP2_LITERAL(opline)) != IS_LONG) {
- convert_to_long(&ZEND_OP2_LITERAL(opline));
+ /* don't optimise if it should produce a runtime numeric string error */
+ if (!(Z_TYPE(ZEND_OP2_LITERAL(opline)) == IS_STRING
+ && !is_numeric_string(Z_STRVAL(ZEND_OP2_LITERAL(opline)), Z_STRLEN(ZEND_OP2_LITERAL(opline)), NULL, NULL, 0))) {
+ convert_to_long(&ZEND_OP2_LITERAL(opline));
+ }
}
}
break;
$j = $i+1;
$dir = $allDirs[$i];
echo "\n-- Iteration $j --\n";
- $res = file_put_contents($dir."/".$filename, ($data + $i));
+ $res = file_put_contents($dir."/".$filename, ($data . $i));
if ($res !== false) {
$in = file_get_contents($absFile);
- if ($in == ($data + $i)) {
+ if ($in == ($data . $i)) {
echo "Data written correctly\n";
}
else {
Warning: file_put_contents(BADDIR/FileGetContentsVar7.tmp): failed to open stream: %s in %s on line %d
No data written
-*** Done ***
\ No newline at end of file
+*** Done ***
float(-5000000)
*** Testing floatval() on non floating types ***
+
+Notice: A non well formed numeric value encountered in %s on line 69
+
+Notice: A non well formed numeric value encountered in %s on line 70
float(-2147483648)
float(2147483648)
float(%d)
?>
===DONE===
--EXPECTF--
+
+Notice: A non well formed numeric value encountered in %s on line %d
+
+Notice: A non well formed numeric value encountered in %s on line %d
+
*** Testing floatval() on non floating types ***
-- Iteration : -2147483648 --
-- Iteration : null --
float(0)
-===DONE===
\ No newline at end of file
+===DONE===
-- Iteration 18 --
string(6) "string"
bool(true)
-int(1)
+int(100)
string(7) "integer"
-- Iteration 19 --
string(6) "string"
-- Iteration 21 --
string(6) "string"
bool(true)
-int(-1)
+int(0)
string(7) "integer"
-- Iteration 22 --
string(6) "string"
-- Iteration 24 --
string(6) "string"
bool(true)
-int(1)
+int(100)
string(7) "integer"
-- Iteration 25 --
string(6) "string"
-- Iteration 27 --
string(6) "string"
bool(true)
-int(-1)
+int(0)
string(7) "integer"
-- Iteration 28 --
string(6) "string"
-- Iteration 18 --
string(6) "string"
bool(true)
-int(1)
+int(100)
string(7) "integer"
-- Iteration 19 --
string(6) "string"
-- Iteration 21 --
string(6) "string"
bool(true)
-int(-1)
+int(0)
string(7) "integer"
-- Iteration 22 --
string(6) "string"
-- Iteration 24 --
string(6) "string"
bool(true)
-int(1)
+int(100)
string(7) "integer"
-- Iteration 25 --
string(6) "string"
-- Iteration 27 --
string(6) "string"
bool(true)
-int(-1)
+int(0)
string(7) "integer"
-- Iteration 28 --
string(6) "string"
string(7) "1011111"
string(4) "1010"
string(12) "111101101110"
-string(2) "11"
+string(12) "111101101110"
string(6) "100111"
string(1) "0"
string(1) "1"
string(2) "5f"
string(1) "a"
string(3) "f6e"
-string(1) "3"
+string(3) "f6e"
string(2) "27"
string(1) "0"
string(1) "1"
string(3) "137"
string(2) "12"
string(4) "7556"
-string(1) "3"
+string(4) "7556"
string(2) "47"
string(1) "0"
string(1) "1"
int(0)
-- Iteration 17 --
+
+Warning: A non-numeric value encountered in %s on line %d
int(0)
-- Iteration 18 --
+
+Warning: A non-numeric value encountered in %s on line %d
int(0)
-- Iteration 19 --
int(0)
-- Iteration 20 --
+
+Warning: A non-numeric value encountered in %s on line %d
int(0)
-- Iteration 21 --
+
+Warning: A non-numeric value encountered in %s on line %d
int(0)
-- Iteration 22 --
+
+Warning: A non-numeric value encountered in %s on line %d
int(0)
-- Iteration 23 --
int(0)
-- Iteration 17 --
+
+Warning: A non-numeric value encountered in %s on line %d
int(0)
-- Iteration 18 --
+
+Warning: A non-numeric value encountered in %s on line %d
int(0)
-- Iteration 19 --
int(0)
-- Iteration 20 --
+
+Warning: A non-numeric value encountered in %s on line %d
int(0)
-- Iteration 21 --
+
+Warning: A non-numeric value encountered in %s on line %d
int(0)
-- Iteration 22 --
+
+Warning: A non-numeric value encountered in %s on line %d
int(0)
-- Iteration 23 --
float(1)
-- Iteration 17 --
+
+Warning: A non-numeric value encountered in %s on line %d
float(1)
-- Iteration 18 --
+
+Warning: A non-numeric value encountered in %s on line %d
float(1)
-- Iteration 19 --
int(1)
-- Iteration 20 --
+
+Warning: A non-numeric value encountered in %s on line %d
float(1)
-- Iteration 21 --
+
+Warning: A non-numeric value encountered in %s on line %d
float(1)
-- Iteration 22 --
+
+Warning: A non-numeric value encountered in %s on line %d
float(1)
-- Iteration 23 --
[0]=>
string(0) ""
}
+
+Warning: A non-numeric value encountered in %s on line %d
array(1) {
[0]=>
string(40) "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
ZEND_PARSE_PARAMETERS_END();
#endif
- if (Z_TYPE_P(num) != IS_STRING) {
+ if (Z_TYPE_P(num) != IS_STRING || base == 10) {
RETVAL_LONG(zval_get_long(num));
} else {
RETVAL_LONG(ZEND_STRTOL(Z_STRVAL_P(num), NULL, base));
echo ($v+0)."\n";
}
?>
---EXPECT--
+--EXPECTF--
+
+Warning: A non-numeric value encountered in %s on line %d
0
+
+Warning: A non-numeric value encountered in %s on line %d
0
+
+Warning: A non-numeric value encountered in %s on line %d
0
+
+Warning: A non-numeric value encountered in %s on line %d
0
+
+Warning: A non-numeric value encountered in %s on line %d
0
+
+Warning: A non-numeric value encountered in %s on line %d
0
--- testing: '123abc' << 'a5.9' ---\r
int(123)\r
--- testing: '123e5' << '0' ---\r
-int(123)\r
+int(12300000)\r
--- testing: '123e5' << '65' ---\r
int(0)\r
--- testing: '123e5' << '-44' ---\r
Exception: Bit shift by negative number\r
--- testing: '123e5' << '1.2' ---\r
-int(246)\r
+int(24600000)\r
--- testing: '123e5' << '-7.7' ---\r
Exception: Bit shift by negative number\r
--- testing: '123e5' << 'abc' ---\r
-int(123)\r
+int(12300000)\r
--- testing: '123e5' << '123abc' ---\r
int(0)\r
--- testing: '123e5' << '123e5' ---\r
--- testing: '123e5' << '123abc ' ---\r
int(0)\r
--- testing: '123e5' << '3.4a' ---\r
-int(984)\r
+int(98400000)\r
--- testing: '123e5' << 'a5.9' ---\r
-int(123)\r
+int(12300000)\r
--- testing: '123e5xyz' << '0' ---\r
-int(123)\r
+int(12300000)\r
--- testing: '123e5xyz' << '65' ---\r
int(0)\r
--- testing: '123e5xyz' << '-44' ---\r
Exception: Bit shift by negative number\r
--- testing: '123e5xyz' << '1.2' ---\r
-int(246)\r
+int(24600000)\r
--- testing: '123e5xyz' << '-7.7' ---\r
Exception: Bit shift by negative number\r
--- testing: '123e5xyz' << 'abc' ---\r
-int(123)\r
+int(12300000)\r
--- testing: '123e5xyz' << '123abc' ---\r
int(0)\r
--- testing: '123e5xyz' << '123e5' ---\r
--- testing: '123e5xyz' << '123abc ' ---\r
int(0)\r
--- testing: '123e5xyz' << '3.4a' ---\r
-int(984)\r
+int(98400000)\r
--- testing: '123e5xyz' << 'a5.9' ---\r
-int(123)\r
+int(12300000)\r
--- testing: ' 123abc' << '0' ---\r
int(123)\r
--- testing: ' 123abc' << '65' ---\r
--- testing: '123abc' >> 'a5.9' ---
int(123)
--- testing: '123e5' >> '0' ---
-int(123)
+int(12300000)
--- testing: '123e5' >> '65' ---
int(0)
--- testing: '123e5' >> '-44' ---
Exception: Bit shift by negative number
--- testing: '123e5' >> '1.2' ---
-int(61)
+int(6150000)
--- testing: '123e5' >> '-7.7' ---
Exception: Bit shift by negative number
--- testing: '123e5' >> 'abc' ---
-int(123)
+int(12300000)
--- testing: '123e5' >> '123abc' ---
int(0)
--- testing: '123e5' >> '123e5' ---
--- testing: '123e5' >> '123abc ' ---
int(0)
--- testing: '123e5' >> '3.4a' ---
-int(15)
+int(1537500)
--- testing: '123e5' >> 'a5.9' ---
-int(123)
+int(12300000)
--- testing: '123e5xyz' >> '0' ---
-int(123)
+int(12300000)
--- testing: '123e5xyz' >> '65' ---
int(0)
--- testing: '123e5xyz' >> '-44' ---
Exception: Bit shift by negative number
--- testing: '123e5xyz' >> '1.2' ---
-int(61)
+int(6150000)
--- testing: '123e5xyz' >> '-7.7' ---
Exception: Bit shift by negative number
--- testing: '123e5xyz' >> 'abc' ---
-int(123)
+int(12300000)
--- testing: '123e5xyz' >> '123abc' ---
int(0)
--- testing: '123e5xyz' >> '123e5' ---
--- testing: '123e5xyz' >> '123abc ' ---
int(0)
--- testing: '123e5xyz' >> '3.4a' ---
-int(15)
+int(1537500)
--- testing: '123e5xyz' >> 'a5.9' ---
-int(123)
+int(12300000)
--- testing: ' 123abc' >> '0' ---
int(123)
--- testing: ' 123abc' >> '65' ---
--- testing: '123abc' % '123abc' ---\r
int(0)\r
--- testing: '123abc' % '123e5' ---\r
-int(0)\r
+int(123)\r
--- testing: '123abc' % '123e5xyz' ---\r
-int(0)\r
+int(123)\r
--- testing: '123abc' % ' 123abc' ---\r
int(0)\r
--- testing: '123abc' % '123 abc' ---\r
--- testing: '123e5' % '0' ---\r
Exception: Modulo by zero\r
--- testing: '123e5' % '65' ---\r
-int(58)\r
+int(50)\r
--- testing: '123e5' % '-44' ---\r
-int(35)\r
+int(20)\r
--- testing: '123e5' % '1.2' ---\r
int(0)\r
--- testing: '123e5' % '-7.7' ---\r
-int(4)\r
+int(6)\r
--- testing: '123e5' % 'abc' ---\r
Exception: Modulo by zero\r
--- testing: '123e5' % '123abc' ---\r
--- testing: '123e5xyz' % '0' ---\r
Exception: Modulo by zero\r
--- testing: '123e5xyz' % '65' ---\r
-int(58)\r
+int(50)\r
--- testing: '123e5xyz' % '-44' ---\r
-int(35)\r
+int(20)\r
--- testing: '123e5xyz' % '1.2' ---\r
int(0)\r
--- testing: '123e5xyz' % '-7.7' ---\r
-int(4)\r
+int(6)\r
--- testing: '123e5xyz' % 'abc' ---\r
Exception: Modulo by zero\r
--- testing: '123e5xyz' % '123abc' ---\r
--- testing: ' 123abc' % '123abc' ---\r
int(0)\r
--- testing: ' 123abc' % '123e5' ---\r
-int(0)\r
+int(123)\r
--- testing: ' 123abc' % '123e5xyz' ---\r
-int(0)\r
+int(123)\r
--- testing: ' 123abc' % ' 123abc' ---\r
int(0)\r
--- testing: ' 123abc' % '123 abc' ---\r
--- testing: '123 abc' % '123abc' ---\r
int(0)\r
--- testing: '123 abc' % '123e5' ---\r
-int(0)\r
+int(123)\r
--- testing: '123 abc' % '123e5xyz' ---\r
-int(0)\r
+int(123)\r
--- testing: '123 abc' % ' 123abc' ---\r
int(0)\r
--- testing: '123 abc' % '123 abc' ---\r
--- testing: '123abc ' % '123abc' ---\r
int(0)\r
--- testing: '123abc ' % '123e5' ---\r
-int(0)\r
+int(123)\r
--- testing: '123abc ' % '123e5xyz' ---\r
-int(0)\r
+int(123)\r
--- testing: '123abc ' % ' 123abc' ---\r
int(0)\r
--- testing: '123abc ' % '123 abc' ---\r
\r
?>\r
===DONE===\r
---EXPECT--\r
+--EXPECTF--\r
--- testing: '0' ---
int(0)
--- testing: '65' ---
--- testing: '-7.7' ---
float(7.7)
--- testing: 'abc' ---
+
+Warning: A non-numeric value encountered in %s on line %d
int(0)
--- testing: '123abc' ---
+
+Notice: A non well formed numeric value encountered in %s on line %d
int(-123)
--- testing: '123e5' ---
float(-12300000)
--- testing: '123e5xyz' ---
+
+Notice: A non well formed numeric value encountered in %s on line %d
float(-12300000)
--- testing: ' 123abc' ---
+
+Notice: A non well formed numeric value encountered in %s on line %d
int(-123)
--- testing: '123 abc' ---
+
+Notice: A non well formed numeric value encountered in %s on line %d
int(-123)
--- testing: '123abc ' ---
+
+Notice: A non well formed numeric value encountered in %s on line %d
int(-123)
--- testing: '3.4a' ---
+
+Notice: A non well formed numeric value encountered in %s on line %d
float(-3.4)
--- testing: 'a5.9' ---
+
+Warning: A non-numeric value encountered in %s on line %d
int(0)\r
===DONE===\r