summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBertrand Jacquin <bertrand@jacquin.bzh>2018-01-10 00:22:04 +0000
committerBertrand Jacquin <bertrand@jacquin.bzh>2018-01-14 00:05:22 +0000
commite08130392f8e4e4c601aef54a05be810bec2dfed (patch)
treee49a31f27fd6efc253b7fcedd3d8ce1911dd31b1
parentMINOR: php: Add precedence on php.h over zend.h (diff)
downloadmod_virtualvalue-e08130392f8e4e4c601aef54a05be810bec2dfed.tar.gz
MAJOR: php: Add compatibility with PHP7v0.4.2
-rw-r--r--al_php.c23
1 files changed, 19 insertions, 4 deletions
diff --git a/al_php.c b/al_php.c
index 4aac5b8..fdc0545 100644
--- a/al_php.c
+++ b/al_php.c
@@ -24,7 +24,13 @@
#include <php_ini.h>
#include <zend.h>
-#include <zend_qsort.h>
+
+#if PHP_MAJOR_VERSION < 7
+# include <zend_qsort.h>
+#else
+# include <zend_sort.h>
+#endif
+
#include <zend_API.h>
#include <zend_ini.h>
#include <zend_alloc.h>
@@ -33,6 +39,14 @@
#include "mod_virtualvalue.h"
#include "al_php.h"
+#if PHP_MAJOR_VERSION < 7
+# define MOD_VIRTUALVALUE__ZEND_ALTER_INI_ENTRY__STR(_str) \
+ _str, strlen(_str) + 1
+#else
+# define MOD_VIRTUALVALUE__ZEND_ALTER_INI_ENTRY__STR(_str) \
+ zend_string_init(_str, strlen(_str), 1)
+#endif
+
int vv_php_alter_ini(int argc __U__, char **argv, request_rec *r)
{
char *arg;
@@ -40,9 +54,10 @@ int vv_php_alter_ini(int argc __U__, char **argv, request_rec *r)
VV_debug("Translating %s %s", argv[0], argv[1]);
arg = vv_flat_arg(argv[1], r);
- if (zend_alter_ini_entry(argv[0], strlen(argv[0]) + 1, arg, strlen(arg),
- PHP_INI_SYSTEM, PHP_INI_STAGE_STARTUP) == -1)
- VV_error("zend_alter_ini_entry() failed (%s %s)", argv[0], arg);
+ if (zend_alter_ini_entry_ex(MOD_VIRTUALVALUE__ZEND_ALTER_INI_ENTRY__STR(argv[0]),
+ MOD_VIRTUALVALUE__ZEND_ALTER_INI_ENTRY__STR(arg),
+ PHP_INI_SYSTEM, PHP_INI_STAGE_HTACCESS, 1) == FAILURE)
+ VV_error("zend_alter_ini_entry_ex() failed (%s %s)", argv[0], arg);
VV_debug("Altered to %s %s", argv[0], arg);