php-src/Zend/tests/bug38623.phpt
Tyson Andre 32e2d97a26
Allow internal functions to declare if they support compile-time evaluation, add functions. (#7780)
https://wiki.php.net/rfc/strtolower-ascii means that these functions no longer
depend on the current locale in php 8.2. Before that, this was unsafe to
evaluate at compile time.

Followup to GH-7506

Add strcmp/strcasecmp/strtolower/strtoupper functions

Add bin2hex/hex2bin and related functions

Update test of garbage collection using strtolower to use something else to create a refcounted string
2021-12-20 09:27:06 -05:00

23 lines
511 B
PHP

--TEST--
Bug #38623 (leaks in a tricky code with switch() and exceptions)
--FILE--
<?php
/* This used to use strtolower, but opcache evaluates that at compile time as of php 8.2 https://wiki.php.net/rfc/strtolower-ascii */
function create_refcounted_string() {
$x = 'bpache';
$x[0] = 'a';
return $x;
}
try {
switch(create_refcounted_string()) {
case "apache":
throw new Exception("test");
break;
}
} catch (Exception $e) {
echo "ok\n";
}
?>
--EXPECT--
ok