1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00
Files
archived-php-src/Zend/tests/bug71300.phpt

44 lines
1.3 KiB
PHP

--TEST--
Bug #71300 (Segfault in zend_fetch_string_offset)
--FILE--
<?php
function test1() {
for ($n = 'a'; $n < 'g'; $n++) {
$$n = 1;
}
$$n = $$n[++$n] = "test";
return $$n;
}
var_dump(test1());
function test2() {
/* See #71303 for why not using for loop here */
$n = "a";
$$n .= $$n[++$n] = "test";
return $$n;
}
var_dump(test2());
?>
--EXPECTF--
Deprecated: Increment on non-numeric string is deprecated, use str_increment() instead in %s on line %d
Deprecated: Increment on non-numeric string is deprecated, use str_increment() instead in %s on line %d
Deprecated: Increment on non-numeric string is deprecated, use str_increment() instead in %s on line %d
Deprecated: Increment on non-numeric string is deprecated, use str_increment() instead in %s on line %d
Deprecated: Increment on non-numeric string is deprecated, use str_increment() instead in %s on line %d
Deprecated: Increment on non-numeric string is deprecated, use str_increment() instead in %s on line %d
Deprecated: Increment on non-numeric string is deprecated, use str_increment() instead in %s on line %d
string(4) "test"
Deprecated: Increment on non-numeric string is deprecated, use str_increment() instead in %s on line %d
Warning: Array to string conversion in %s on line %d
string(9) "Arraytest"