mirror of
https://github.com/php/php-src.git
synced 2024-11-27 03:44:07 +08:00
7353c7ce17
The temporary HashTable has a destructor that releases the string held by the entry's value. However, browscap_intern_str(_ci) only incremented the refcount for the reference created by the return value. As the HashTable is only used during parsing, we don't need to manage the reference count of the value anyway, so get rid of the destructor. This is triggerable in two cases: - When using php_admin_value to set the ini at the activation stage - When running out of space for the opcache-interned strings Closes GH-12634.
47 lines
851 B
PHP
47 lines
851 B
PHP
--TEST--
|
|
GH-12621 (browscap segmentation fault when configured with php_admin_value)
|
|
--SKIPIF--
|
|
<?php include "skipif.inc"; ?>
|
|
--FILE--
|
|
<?php
|
|
|
|
require_once "tester.inc";
|
|
|
|
$cfg = <<<EOT
|
|
[global]
|
|
error_log = {{FILE:LOG}}
|
|
[unconfined]
|
|
listen = {{ADDR}}
|
|
pm = dynamic
|
|
pm.max_children = 5
|
|
pm.start_servers = 1
|
|
pm.min_spare_servers = 1
|
|
pm.max_spare_servers = 3
|
|
|
|
EOT;
|
|
$cfg .= 'php_admin_value[browscap] = ' . __DIR__ . '/../../../ext/standard/tests/misc/browscap.ini';
|
|
|
|
$code = <<<EOT
|
|
<?php
|
|
\$cv = get_browser("Konqueror/2.0")->browser_name_pattern;
|
|
var_dump(\$cv);
|
|
EOT;
|
|
|
|
$tester = new FPM\Tester($cfg, $code);
|
|
$tester->start();
|
|
$tester->expectLogStartNotices();
|
|
echo $tester
|
|
->request()
|
|
->getBody();
|
|
$tester->terminate();
|
|
$tester->close();
|
|
|
|
?>
|
|
--EXPECT--
|
|
string(14) "*Konqueror/2.*"
|
|
--CLEAN--
|
|
<?php
|
|
require_once "tester.inc";
|
|
FPM\Tester::clean();
|
|
?>
|