summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjvoisin2020-11-29 19:38:13 +0100
committerGitHub2020-11-29 18:38:13 +0000
commitea7c76bce6a4704db867210acfad7cab73106ef2 (patch)
treed8d68572374f02a063975d5a27c9fd277af3b6a5
parent5be9082f148ab546a0317a28ef5267bb797feb53 (diff)
Don't call libxml_disable_entity_loader for php8+
This functions is deprecated, but since PHP8+ requires libxml 2.9.0 where XXE are disabled by default, there is no need to call it anymore.
-rw-r--r--src/sp_disable_xxe.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/sp_disable_xxe.c b/src/sp_disable_xxe.c
index 53148c8..9ebcbad 100644
--- a/src/sp_disable_xxe.c
+++ b/src/sp_disable_xxe.c
@@ -9,12 +9,15 @@ int hook_libxml_disable_entity_loader() {
9 9
10 TSRMLS_FETCH(); 10 TSRMLS_FETCH();
11 11
12// External entities are disabled by default in PHP8+
13#if PHP_VERSION_ID < 80000
12 /* Call the php function here instead of re-implementing it is a bit 14 /* Call the php function here instead of re-implementing it is a bit
13 * ugly, but we do not want to introduce compile-time dependencies against 15 * ugly, but we do not want to introduce compile-time dependencies against
14 * libxml. */ 16 * libxml. */
15 ZVAL_STRING(&func_name, "libxml_disable_entity_loader"); 17 ZVAL_STRING(&func_name, "libxml_disable_entity_loader");
16 ZVAL_STRING(&params[0], "true"); 18 ZVAL_STRING(&params[0], "true");
17 call_user_function(CG(function_table), NULL, &func_name, &hmac, 1, params); 19 call_user_function(CG(function_table), NULL, &func_name, &hmac, 1, params);
20#endif
18 21
19 HOOK_FUNCTION("libxml_disable_entity_loader", sp_internal_functions_hook, 22 HOOK_FUNCTION("libxml_disable_entity_loader", sp_internal_functions_hook,
20 PHP_FN(sp_libxml_disable_entity_loader)); 23 PHP_FN(sp_libxml_disable_entity_loader));