Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make numeric operations on resources, arrays and objects type errors #5331

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Try to fix 32-bit tests
  • Loading branch information
nikic committed Apr 30, 2020
commit 63a2238cf17cd4d3cdb6b5a7c16702a3dcd3ba98
9 changes: 8 additions & 1 deletion Zend/tests/decrement_001.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,18 @@ $a = array(
);

foreach ($a as $var) {
$var--;
try {
$var--;
} catch (TypeError $e) {
echo $e->getMessage(), "\n";
}
var_dump($var);
}

echo "Done\n";
?>
--EXPECTF--
Cannot decrement array
array(3) {
[0]=>
int(1)
Expand All @@ -51,8 +56,10 @@ float(1.5)
NULL
bool(true)
bool(false)
Cannot decrement object
object(stdClass)#%d (0) {
}
Cannot decrement array
array(0) {
}
float(-2147483649)
Expand Down
9 changes: 8 additions & 1 deletion Zend/tests/increment_001.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,18 @@ $a = array(
);

foreach ($a as $var) {
$var++;
try {
$var++;
} catch (TypeError $e) {
echo $e->getMessage(), "\n";
}
var_dump($var);
}

echo "Done\n";
?>
--EXPECTF--
Cannot decrement array
array(3) {
[0]=>
int(1)
Expand All @@ -51,8 +56,10 @@ float(3.5)
int(1)
bool(true)
bool(false)
Cannot decrement object
object(stdClass)#%d (0) {
}
Cannot decrement array
array(0) {
}
float(2147483648)
Expand Down
4 changes: 1 addition & 3 deletions ext/standard/tests/math/pow_variation1.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -174,9 +174,7 @@ Warning: A non-numeric value encountered in %s on line %d
int(0)

-- Iteration 23 --

Notice: Object of class classA could not be converted to number in %s on line %d
int(1)
Unsupported operand types: object ** int

-- Iteration 24 --
int(0)
Expand Down