Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Zend/tests/add_006.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,13 @@ var_dump($c);
echo "Done\n";
?>
--EXPECTF--
Unsupported operand types: int + string
Unsupported operand types: int + non-numeric-string

Warning: A non-numeric value encountered in %s on line %d
int(951858)
int(48550510)
float(75661.68)
Unsupported operand types: string + int
Unsupported operand types: non-numeric-string + int

Warning: A non-numeric value encountered in %s on line %d
int(951858)
Expand Down
4 changes: 2 additions & 2 deletions Zend/tests/add_007.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ var_dump($c);
echo "Done\n";
?>
--EXPECTF--
Exception: Unsupported operand types: array + string
Exception: Unsupported operand types: array + non-numeric-string

Fatal error: Uncaught TypeError: Unsupported operand types: array + string in %s:%d
Fatal error: Uncaught TypeError: Unsupported operand types: array + non-numeric-string in %s:%d
Stack trace:
#0 {main}
thrown in %s on line %d
4 changes: 2 additions & 2 deletions Zend/tests/arrow_functions/006.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ try {
--EXPECTF--
int(2)
int(10)
{closure:%s:%d}(): Argument #1 ($x) must be of type int, string given, called in %s on line %d
{closure:%s:%d}(): Argument #1 ($x) must be of type int, non-numeric-string given, called in %s on line %d
array(3) {
[0]=>
int(20)
Expand All @@ -41,4 +41,4 @@ array(3) {
[2]=>
int(30)
}
{closure:%s:%d}(): Argument #2 must be of type ?int, string given, called in %s on line %d
{closure:%s:%d}(): Argument #2 must be of type ?int, non-numeric-string given, called in %s on line %d
2 changes: 1 addition & 1 deletion Zend/tests/exceptions/exception_017.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ Error: Cannot call abstract method C::foo() in %s:%d
Stack trace:
#0 {main}

TypeError: foo(): Argument #1 ($x) must be of type callable, string given, called in %s:%d
TypeError: foo(): Argument #1 ($x) must be of type callable, non-numeric-string given, called in %s:%d
Stack trace:
#0 %s(%d): foo('C::foo')
#1 {main}
Expand Down
2 changes: 1 addition & 1 deletion Zend/tests/fibers/start-arguments.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ $fiber->start('test');
--EXPECTF--
int(1)

Fatal error: Uncaught TypeError: {closure:%s:%d}(): Argument #1 ($x) must be of type int, string given in %s:%d
Fatal error: Uncaught TypeError: {closure:%s:%d}(): Argument #1 ($x) must be of type int, non-numeric-string given in %s:%d
Stack trace:
#0 [internal function]: {closure:%s:%d}('test')
#1 %sstart-arguments.php(%d): Fiber->start('test')
Expand Down
35 changes: 35 additions & 0 deletions Zend/tests/non_numarix_string_operand_error.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
--TEST--
Error message for non-numaric strings in arithmetic contexts
--FILE--
<?php
declare(strict_types=0);

function foo(int $a) { echo $a; }

function msg(TypeError $e){
$split = explode(', called in', $e->getMessage(), 2);
return $split[0];
}

var_dump(1 + "1");
try { var_dump(1 + "hello"); } catch (TypeError $e) { echo $e->getMessage(), "\n"; }
try { var_dump(1 + ""); } catch (TypeError $e) { echo $e->getMessage(), "\n"; }
try { var_dump("hello" + 1); } catch (TypeError $e) { echo $e->getMessage(), "\n"; }
try { var_dump("" + 1); } catch (TypeError $e) { echo $e->getMessage(), "\n"; }

foo("1");
echo "\n";
try { foo("hello"); } catch (TypeError $e) { echo msg($e), "\n"; }
try { foo(""); } catch (TypeError $e) { echo msg($e), "\n"; }
?>
===DONE===
--EXPECT--
int(2)
Unsupported operand types: int + non-numeric-string
Unsupported operand types: int + empty-string
Unsupported operand types: non-numeric-string + int
Unsupported operand types: empty-string + int
1
foo(): Argument #1 ($a) must be of type int, non-numeric-string given
foo(): Argument #1 ($a) must be of type int, empty-string given
===DONE===
Original file line number Diff line number Diff line change
Expand Up @@ -164,81 +164,81 @@ Warning: A non-numeric value encountered in %s on line %d

Warning: A non-numeric value encountered in %s on line %d
int(5)
Unsupported operand types: string + string
Unsupported operand types: non-numeric-string + non-numeric-string
---

Warning: A non-numeric value encountered in %s on line %d

Warning: A non-numeric value encountered in %s on line %d
int(-2)
Unsupported operand types: string - string
Unsupported operand types: non-numeric-string - non-numeric-string
---

Warning: A non-numeric value encountered in %s on line %d

Warning: A non-numeric value encountered in %s on line %d
int(143)
Unsupported operand types: string * string
Unsupported operand types: non-numeric-string * non-numeric-string
---

Warning: A non-numeric value encountered in %s on line %d

Warning: A non-numeric value encountered in %s on line %d
float(0.8947368421052632)
Unsupported operand types: string / string
Unsupported operand types: non-numeric-string / non-numeric-string
---

Warning: A non-numeric value encountered in %s on line %d

Warning: A non-numeric value encountered in %s on line %d
float(3.0910586430935376E+39)
Unsupported operand types: string ** string
Unsupported operand types: non-numeric-string ** non-numeric-string
---

Warning: A non-numeric value encountered in %s on line %d

Warning: A non-numeric value encountered in %s on line %d
int(31)
TypeError: Unsupported operand types: string % string
TypeError: Unsupported operand types: non-numeric-string % non-numeric-string
---

Warning: A non-numeric value encountered in %s on line %d

Warning: A non-numeric value encountered in %s on line %d
int(%d)
Unsupported operand types: string << string
Unsupported operand types: non-numeric-string << non-numeric-string
string(4) "quis"
---

Warning: A non-numeric value encountered in %s on line %d

Warning: A non-numeric value encountered in %s on line %d
int(0)
Unsupported operand types: string >> string
Unsupported operand types: non-numeric-string >> non-numeric-string
---

Warning: A non-numeric value encountered in %s on line %d
int(63)

Warning: A non-numeric value encountered in %s on line %d
int(71)
Unsupported operand types: string | int
Unsupported operand types: int | string
Unsupported operand types: non-numeric-string | int
Unsupported operand types: int | non-numeric-string
---

Warning: A non-numeric value encountered in %s on line %d
int(81)

Warning: A non-numeric value encountered in %s on line %d
int(97)
Unsupported operand types: string & int
Unsupported operand types: int & string
Unsupported operand types: non-numeric-string & int
Unsupported operand types: int & non-numeric-string
---

Warning: A non-numeric value encountered in %s on line %d
int(28)

Warning: A non-numeric value encountered in %s on line %d
int(252)
Unsupported operand types: string ^ int
Unsupported operand types: int ^ string
Unsupported operand types: non-numeric-string ^ int
Unsupported operand types: int ^ non-numeric-string
Original file line number Diff line number Diff line change
Expand Up @@ -117,90 +117,90 @@ Warning: A non-numeric value encountered in %s on line %d

Warning: A non-numeric value encountered in %s on line %d
int(5)
Unsupported operand types: string + string
Unsupported operand types: non-numeric-string + non-numeric-string
---

Warning: A non-numeric value encountered in %s on line %d

Warning: A non-numeric value encountered in %s on line %d
int(-2)
Unsupported operand types: string - string
Unsupported operand types: non-numeric-string - non-numeric-string
---

Warning: A non-numeric value encountered in %s on line %d

Warning: A non-numeric value encountered in %s on line %d
int(143)
Unsupported operand types: string * string
Unsupported operand types: non-numeric-string * non-numeric-string
---

Warning: A non-numeric value encountered in %s on line %d

Warning: A non-numeric value encountered in %s on line %d
float(0.8947368421052632)
Unsupported operand types: string / string
Unsupported operand types: non-numeric-string / non-numeric-string
---

Warning: A non-numeric value encountered in %s on line %d

Warning: A non-numeric value encountered in %s on line %d
float(3.0910586430935376E+39)
Unsupported operand types: string ** string
Unsupported operand types: non-numeric-string ** non-numeric-string
---

Warning: A non-numeric value encountered in %s on line %d

Warning: A non-numeric value encountered in %s on line %d
int(31)
TypeError: Unsupported operand types: string % string
TypeError: Unsupported operand types: non-numeric-string % non-numeric-string
---

Warning: A non-numeric value encountered in %s on line %d

Warning: A non-numeric value encountered in %s on line %d
int(%d)
Unsupported operand types: string << string
Unsupported operand types: non-numeric-string << non-numeric-string
---

Warning: A non-numeric value encountered in %s on line %d

Warning: A non-numeric value encountered in %s on line %d
int(0)
Unsupported operand types: string >> string
Unsupported operand types: non-numeric-string >> non-numeric-string
---

Warning: A non-numeric value encountered in %s on line %d
int(63)

Warning: A non-numeric value encountered in %s on line %d
int(71)
Unsupported operand types: string | int
Unsupported operand types: int | string
Unsupported operand types: non-numeric-string | int
Unsupported operand types: int | non-numeric-string
---

Warning: A non-numeric value encountered in %s on line %d
int(81)

Warning: A non-numeric value encountered in %s on line %d
int(97)
Unsupported operand types: string & int
Unsupported operand types: int & string
Unsupported operand types: non-numeric-string & int
Unsupported operand types: int & non-numeric-string
---

Warning: A non-numeric value encountered in %s on line %d
int(28)

Warning: A non-numeric value encountered in %s on line %d
int(252)
Unsupported operand types: string ^ int
Unsupported operand types: int ^ string
Unsupported operand types: non-numeric-string ^ int
Unsupported operand types: int ^ non-numeric-string
---

Warning: A non-numeric value encountered in %s on line %d
int(149)
Unsupported operand types: string * int
Unsupported operand types: non-numeric-string * int
---

Warning: A non-numeric value encountered in %s on line %d
int(-151)
Unsupported operand types: string * int
Unsupported operand types: non-numeric-string * int
Loading