mirror of
https://github.com/php/php-src.git
synced 2024-11-27 20:03:40 +08:00
32e2d97a26
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
23 lines
511 B
PHP
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
|