Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Zend/zend_system_id.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ ZEND_API zend_result zend_add_system_entropy(const char *module_name, const char

void zend_startup_system_id(void)
{
finalized = 0;
PHP_MD5Init(&context);
PHP_MD5Update(&context, PHP_VERSION, sizeof(PHP_VERSION)-1);
PHP_MD5Update(&context, ZEND_EXTENSION_BUILD_ID, sizeof(ZEND_EXTENSION_BUILD_ID)-1);
Expand Down
6 changes: 6 additions & 0 deletions ext/zend_test/test.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
#include "test_arginfo.h"
#include "zend_call_stack.h"
#include "zend_exceptions.h"
#include "zend_system_id.h"
#include "zend_mm_custom_handlers.h"
#include <signal.h>

Expand Down Expand Up @@ -1149,6 +1150,7 @@ static ZEND_METHOD(_ZendTestMagicCallForward, __call)
}

PHP_INI_BEGIN()
PHP_INI_ENTRY("zend_test.register_system_entropy", "0", PHP_INI_SYSTEM, NULL)
STD_PHP_INI_BOOLEAN("zend_test.replace_zend_execute_ex", "0", PHP_INI_SYSTEM, OnUpdateBool, replace_zend_execute_ex, zend_zend_test_globals, zend_test_globals)
STD_PHP_INI_BOOLEAN("zend_test.register_passes", "0", PHP_INI_SYSTEM, OnUpdateBool, register_passes, zend_zend_test_globals, zend_test_globals)
STD_PHP_INI_BOOLEAN("zend_test.print_stderr_mshutdown", "0", PHP_INI_SYSTEM, OnUpdateBool, print_stderr_mshutdown, zend_zend_test_globals, zend_test_globals)
Expand Down Expand Up @@ -1347,6 +1349,10 @@ PHP_MINIT_FUNCTION(zend_test)
// Loading via dl() not supported with the observer API
if (type != MODULE_TEMPORARY) {
REGISTER_INI_ENTRIES();
if (INI_BOOL("zend_test.register_system_entropy") &&
zend_add_system_entropy("zend_test", "test", ZEND_STRL("test entropy")) == FAILURE) {
php_error_docref(NULL, E_WARNING, "Failed to register system entropy");
}
} else {
(void)ini_entries;
}
Expand Down
40 changes: 40 additions & 0 deletions ext/zend_test/tests/system_id_reinitialization.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
--TEST--
System ID reinitialization accepts extension entropy after engine restart
--SKIPIF--
<?php
if (!extension_loaded('zend_test')) die('skip zend_test extension required');
?>
--INI--
zend_test.register_system_entropy=1
--PHPDBG--
r
clean
r
clean
r
q
--FILE--
<?php
echo "Done\n";
?>
--EXPECTF--
[Successful compilation of %s]
prompt> Done
[Script ended normally]
prompt> Cleaning Execution Environment
Classes %d
Functions %d
Constants %d
Includes 0
[Script ended normally]
prompt> Done
[Script ended normally]
prompt> Cleaning Execution Environment
Classes %d
Functions %d
Constants %d
Includes 0
[Script ended normally]
prompt> Done
[Script ended normally]
prompt>
Loading