1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 16:22:37 +01:00
Files
archived-php-src/ext/opcache/tests/bug77058.phpt
George Peter Banyard d8696f9216 [RFC] Path to Saner Increment/Decrement operators (#10358)
* Add behavioural tests for incdec operators

* Add support to ++/-- for objects castable to _IS_NUMBER

* Add str_increment() function

* Add str_decrement() function

RFC: https://wiki.php.net/rfc/saner-inc-dec-operators

Co-authored-by: Ilija Tovilo <ilija.tovilo@me.com>
Co-authored-by: Arnaud Le Blanc <arnaud.lb@gmail.com>
2023-07-17 15:51:24 +01:00

25 lines
461 B
PHP

--TEST--
Bug #77058: Type inference in opcache causes side effects
--EXTENSIONS--
opcache
--FILE--
<?php
function myfunc(){
$Nr = 0;
while(1){
$x--;
$x++;
if( ++ $Nr >= 2 ) break;
}
echo "'$Nr' is expected to be 2", PHP_EOL;
}
myfunc();
?>
--EXPECTF--
Warning: Undefined variable $x in %s on line %d
Warning: Decrement on type null has no effect, this will change in the next major version of PHP in %s on line %d
'2' is expected to be 2