Skip to content

Commit 14404ac

Browse files
committed
Merge branch 'PHP-8.3'
2 parents 6b1d060 + 2913447 commit 14404ac

File tree

4 files changed

+67
-5
lines changed

4 files changed

+67
-5
lines changed

Zend/zend_ini.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,6 @@ ZEND_API zend_result zend_register_ini_entries_ex(const zend_ini_entry_def *ini_
217217
* lead to death.
218218
*/
219219
if (directives != EG(ini_directives)) {
220-
ZEND_ASSERT(module_type == MODULE_TEMPORARY);
221220
directives = EG(ini_directives);
222221
} else {
223222
ZEND_ASSERT(module_type == MODULE_PERSISTENT);

sapi/fpm/fpm/fpm_php.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,9 @@ int fpm_php_apply_defines_ex(struct key_value_s *kv, int mode) /* {{{ */
8787

8888
if (!strcmp(name, "extension") && *value) {
8989
zval zv;
90+
zend_interned_strings_switch_storage(0);
9091
php_dl(value, MODULE_PERSISTENT, &zv, 1);
92+
zend_interned_strings_switch_storage(1);
9193
return Z_TYPE(zv) == IS_TRUE;
9294
}
9395

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
--TEST--
2+
FPM: gh12232 - loading shared ext in FPM config
3+
--SKIPIF--
4+
<?php
5+
include "skipif.inc";
6+
FPM\Tester::skipIfSharedExtensionNotFound('dl_test');
7+
?>
8+
--FILE--
9+
<?php
10+
11+
require_once "tester.inc";
12+
13+
$cfg = <<<EOT
14+
[global]
15+
error_log = {{FILE:LOG}}
16+
[unconfined]
17+
listen = {{ADDR}}
18+
pm = static
19+
pm.max_children = 1
20+
pm.status_path = /status
21+
catch_workers_output = yes
22+
php_admin_value[extension] = dl_test
23+
EOT;
24+
25+
$code = <<<EOT
26+
<?php
27+
var_dump(extension_loaded('dl_test'));
28+
var_dump(ini_get('dl_test.string'));
29+
ini_set('dl_test.string', 'test');
30+
var_dump(ini_get('dl_test.string'));
31+
EOT;
32+
33+
$tester = new FPM\Tester($cfg, $code);
34+
$tester->start();
35+
$tester->expectLogStartNotices();
36+
$tester->request()->expectBody(['bool(true)', 'string(5) "hello"', 'string(4) "test"']);
37+
$tester->request()->expectBody(['bool(true)', 'string(5) "hello"', 'string(4) "test"']);
38+
$tester->terminate();
39+
$tester->expectLogTerminatingNotices();
40+
$tester->close();
41+
42+
?>
43+
Done
44+
--EXPECT--
45+
Done
46+
--CLEAN--
47+
<?php
48+
require_once "tester.inc";
49+
FPM\Tester::clean();
50+
?>
51+
<?php

sapi/fpm/tests/tester.inc

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -338,6 +338,17 @@ class Tester
338338
}
339339
}
340340

341+
/**
342+
* Skip if shared extension is not available in extension directory.
343+
*/
344+
static public function skipIfSharedExtensionNotFound($extensionName)
345+
{
346+
$soPath = ini_get('extension_dir') . '/' . $extensionName . '.so';
347+
if ( ! file_exists($soPath)) {
348+
die("skip $extensionName extension not present in extension_dir");
349+
}
350+
}
351+
341352
/**
342353
* Skip test if supplied shell command fails.
343354
*
@@ -366,11 +377,10 @@ class Tester
366377
/**
367378
* Skip if posix extension not loaded.
368379
*/
369-
static public function skipIfUserDoesNotExist($userName)
370-
{
380+
static public function skipIfUserDoesNotExist($userName) {
371381
self::skipIfPosixNotLoaded();
372-
if (posix_getpwnam($userName) === false) {
373-
die("skip user $userName does not exist");
382+
if ( posix_getpwnam( $userName ) === false ) {
383+
die( "skip user $userName does not exist" );
374384
}
375385
}
376386

0 commit comments

Comments
 (0)