php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Return to Bug #72269
Patch htscanner_php7.0.patch revision 2016-07-03 10:11 UTC by roel at abittechnical dot com
revision 2016-07-02 21:32 UTC by roel at abittechnical dot com
revision 2016-07-02 14:02 UTC by roel at abittechnical dot com
revision 2016-06-05 20:51 UTC by roel at abittechnical dot com
revision 2016-06-05 20:37 UTC by roel at abittechnical dot com
revision 2016-05-31 20:14 UTC by roel at abittechnical dot com

Patch htscanner_php7.0.patch for htscanner Bug #72269

Patch version 2016-07-03 10:11 UTC

Return to Bug #72269 | Download this patch
This patch renders other patches obsolete

Obsolete patches:

Patch Revisions: 2016-07-03 10:11 UTC | 2016-07-02 21:32 UTC | 2016-07-02 14:02 UTC | 2016-06-05 20:51 UTC | 2016-06-05 20:37 UTC | 2016-05-31 20:14 UTC

Developer: roel@abittechnical.com



  --- htscanner.c	2012-03-01 16:14:32.000000000 +0100
 +++ htscanner.c	2016-06-27 09:12:58.333763791 +0200
 @@ -147,8 +147,16 @@
 +++ htscanner.c	2016-07-03 12:08:30.700863832 +0200
 @@ -147,18 +147,40 @@
   #endif
   #if PHP_VERSION_ID < 50204
   	if (zend_alter_ini_entry(name, name_len + 1, value, value_len, mode, PHP_INI_STAGE_RUNTIME) == FAILURE) {
  -#else
  +#elif PHP_VERSION_ID < 70000
   	if (zend_alter_ini_entry(name, name_len + 1, value, value_len, mode, PHP_INI_STAGE_HTACCESS) == FAILURE) {
  +#else
  +	zend_string *zname, *zvalue;
 +	zname = zend_string_init(name, name_len, 0);
 +	zvalue = zend_string_init(value, value_len, 0);
 +	zname = zend_string_init(name, name_len, 1);
 +	zvalue = zend_string_init(value, value_len, 1);
  +	int res = zend_alter_ini_entry(zname, zvalue, mode, PHP_INI_STAGE_HTACCESS);
 +	zend_string_release(zname);
 +	zend_string_release(zvalue);
  +	if (res == FAILURE) {
   #endif
   		htscanner_debug("zend_alter_ini_entry failed!");
   		if (HTG(verbose)) {
 @@ -157,8 +165,22 @@
  			zend_error(E_WARNING, "Adding option (Name: '%s' Value: '%s') (%lu, %lu) failed!\n", name, value, name_len, value_len);
  		}
 +#if PHP_VERSION_ID >= 70000
 +		zend_string_release(zname);
 +		zend_string_release(zvalue);
 +#endif
   		return FAILURE;
   	}
   
  +#if PHP_VERSION_ID < 70000
   	if (ini_entries)
   		zend_hash_update(ini_entries, name, name_len + 1, value, value_len + 1, NULL);
  +#else
 +	zname = zend_string_init(name, name_len, 1);
 +	zvalue = zend_string_init(value, value_len, 1);
 +
  +	zval zval_value;
  +	ZVAL_STR(&zval_value, zvalue);
  +
  +	if (ini_entries)
  +		zend_hash_update(ini_entries, zname, &zval_value);
 +	else
 +		zend_string_release(zvalue);
  +
  +	zend_string_release(zname);
 +	zend_string_release(zvalue);
  +#endif
   
   	return SUCCESS;
   }


  +#endif
   
   static int php_htscanner_create_cache() /* {{{ */
   {
 @@ -347,31 +384,62 @@
 @@ -347,31 +384,57 @@
   #endif
   
   	htscannerMutexLock(ini_entries_cache_mutex);
  +#if PHP_VERSION_ID < 70000
Line 124 (now 125), was 14 lines, now 9 lines

  -#else
  +#elif PHP_VERSION_ID < 70000
   				if (zend_alter_ini_entry(name, len, value, strlen(value), PHP_INI_PERDIR, PHP_INI_STAGE_HTACCESS) == FAILURE) {
  +#else
 +				zend_string *zname, *zvalue;
 +				zname = zend_string_dup(name, 0);
 +				zvalue = zend_string_dup(Z_STR_P(value), 0);
 +				int res = zend_alter_ini_entry(zname, zvalue, PHP_INI_PERDIR, PHP_INI_STAGE_HTACCESS);
 +				zend_string_release(zname);
 +				zend_string_release(zvalue);
 +				int res = zend_alter_ini_entry(name, Z_STR_P(value), PHP_INI_PERDIR, PHP_INI_STAGE_HTACCESS);
  +				if (res == FAILURE) {
   #endif
   					char msg[1024];
  +#if PHP_VERSION_ID < 70000


  +#endif
   			htscannerMutexUnlock(ini_entries_cache_mutex);
   			return SUCCESS;
   		}
 @@ -405,8 +473,13 @@
 @@ -405,8 +468,13 @@
   		}
   	}
   
  +#if PHP_VERSION_ID < 70000
 
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Sat Dec 04 09:03:37 2021 UTC