diff options
| -rw-r--r-- | src/sp_disable_xxe.c | 3 |
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(¶ms[0], "true"); | 18 | ZVAL_STRING(¶ms[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)); |
