Merge branch 'PHP-8.3'

This commit is contained in:
Jakub Zelenka 2023-10-14 18:45:31 +01:00
commit 14404ac1fa
No known key found for this signature in database
GPG Key ID: 1C0779DC5C0A9DE4
4 changed files with 67 additions and 5 deletions

View File

@ -217,7 +217,6 @@ ZEND_API zend_result zend_register_ini_entries_ex(const zend_ini_entry_def *ini_
* lead to death.
*/
if (directives != EG(ini_directives)) {
ZEND_ASSERT(module_type == MODULE_TEMPORARY);
directives = EG(ini_directives);
} else {
ZEND_ASSERT(module_type == MODULE_PERSISTENT);

View File

@ -87,7 +87,9 @@ int fpm_php_apply_defines_ex(struct key_value_s *kv, int mode) /* {{{ */
if (!strcmp(name, "extension") && *value) {
zval zv;
zend_interned_strings_switch_storage(0);
php_dl(value, MODULE_PERSISTENT, &zv, 1);
zend_interned_strings_switch_storage(1);
return Z_TYPE(zv) == IS_TRUE;
}

View File

@ -0,0 +1,51 @@
--TEST--
FPM: gh12232 - loading shared ext in FPM config
--SKIPIF--
<?php
include "skipif.inc";
FPM\Tester::skipIfSharedExtensionNotFound('dl_test');
?>
--FILE--
<?php
require_once "tester.inc";
$cfg = <<<EOT
[global]
error_log = {{FILE:LOG}}
[unconfined]
listen = {{ADDR}}
pm = static
pm.max_children = 1
pm.status_path = /status
catch_workers_output = yes
php_admin_value[extension] = dl_test
EOT;
$code = <<<EOT
<?php
var_dump(extension_loaded('dl_test'));
var_dump(ini_get('dl_test.string'));
ini_set('dl_test.string', 'test');
var_dump(ini_get('dl_test.string'));
EOT;
$tester = new FPM\Tester($cfg, $code);
$tester->start();
$tester->expectLogStartNotices();
$tester->request()->expectBody(['bool(true)', 'string(5) "hello"', 'string(4) "test"']);
$tester->request()->expectBody(['bool(true)', 'string(5) "hello"', 'string(4) "test"']);
$tester->terminate();
$tester->expectLogTerminatingNotices();
$tester->close();
?>
Done
--EXPECT--
Done
--CLEAN--
<?php
require_once "tester.inc";
FPM\Tester::clean();
?>
<?php

View File

@ -338,6 +338,17 @@ class Tester
}
}
/**
* Skip if shared extension is not available in extension directory.
*/
static public function skipIfSharedExtensionNotFound($extensionName)
{
$soPath = ini_get('extension_dir') . '/' . $extensionName . '.so';
if ( ! file_exists($soPath)) {
die("skip $extensionName extension not present in extension_dir");
}
}
/**
* Skip test if supplied shell command fails.
*
@ -366,11 +377,10 @@ class Tester
/**
* Skip if posix extension not loaded.
*/
static public function skipIfUserDoesNotExist($userName)
{
static public function skipIfUserDoesNotExist($userName) {
self::skipIfPosixNotLoaded();
if (posix_getpwnam($userName) === false) {
die("skip user $userName does not exist");
if ( posix_getpwnam( $userName ) === false ) {
die( "skip user $userName does not exist" );
}
}