php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login

Patch New_Fix_type_cast_and_replace_IS_CONSTANT_INDEX_with_IS_CONSTANT_AST for hidef Bug #69235

Patch version 2015-05-18 04:23 UTC

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

Obsolete patches:

Patch Revisions:

Developer: me@umakantpatil.com

commit e20f749b4e832cbe7e4cdbf8240ee70f47cf2652
Author: Umakant <me@umakantpatil.com>
Date:   Mon May 18 09:41:15 2015 +0530

    Fix cast typing and Replace instances of IS_CONSTANT_ARRAY with IS_CONSTANT_AST
    
    IS_CONSTANT_ARRAY and IS_CONSTANT_AST hold the same value
    If IS_CONSTANT_AST is not present, create it from IS_CONSTANT_ARRAY
    
    Ref: https://github.com/php/php-src/commit/82ecdcdb6352f851e351f70f19b85aff06de0e4b#diff-2e4b71f255095863524bb18e8e26b815

diff --git a/frozenarray.c b/frozenarray.c
index 166d4b1..5905287 100644
--- a/frozenarray.c
+++ b/frozenarray.c
@@ -720,7 +720,7 @@ HashTable* frozen_array_get_properties(zval *object TSRMLS_DC)
 
 	if(thawed) 
 	{
-		if(Z_TYPE_P(thawed) == IS_CONSTANT_ARRAY || 
+		if(Z_TYPE_P(thawed) == IS_CONSTANT_AST ||
 			Z_TYPE_P(thawed) == IS_ARRAY)
 		{
 			return Z_ARRVAL_P(thawed);
@@ -925,7 +925,7 @@ zval* frozen_array_copy_zval_ptr(zval* dst, zval* src, int persistent, size_t* a
         break;
 
 		case IS_ARRAY:
-		case IS_CONSTANT_ARRAY:
+		case IS_CONSTANT_AST:
 		{
 			if(!Z_ISREF_P(src))
 			{
@@ -1021,7 +1021,7 @@ void frozen_array_free_zval_ptr(zval** val, int persistent TSRMLS_DC)
         break;
 
 		case IS_ARRAY:
-		case IS_CONSTANT_ARRAY:
+		case IS_CONSTANT_AST:
 			frozen_array_free_hashtable(&Z_ARRVAL_P(value), persistent TSRMLS_CC);
 			break;
 
@@ -1043,7 +1043,7 @@ zval* frozen_array_unserialize(const char* filename TSRMLS_DC)
 	zval* retval;
 	long len = 0;
 	struct stat sb;
-	char *contents, *tmp;
+	char *contents, *tmp, *conl;
 	FILE *fp;
 	php_unserialize_data_t var_hash;
 	HashTable class_table = {0,};
@@ -1080,9 +1080,10 @@ zval* frozen_array_unserialize(const char* filename TSRMLS_DC)
 	orig_class_table = EG(class_table);
 	EG(class_table) = &class_table;
 	zend_objects_store_init(&EG(objects_store), 1024);
+	conl = contents+len;
 	
 	/* I wish I could use json */
-	if(!php_var_unserialize(&data, (const unsigned char**)&tmp, contents+len, &var_hash TSRMLS_CC))
+	if(!php_var_unserialize(&data, (const unsigned char**)&tmp, (const unsigned char*)&conl, &var_hash TSRMLS_CC))
 	{
 		zval_ptr_dtor(&data);
 		free(contents);
diff --git a/php_hidef.h b/php_hidef.h
index 076d5ee..402193d 100644
--- a/php_hidef.h
+++ b/php_hidef.h
@@ -49,6 +49,11 @@ extern zend_module_entry hidef_module_entry;
 #endif
 
 /* b/c for the new macros */
+
+#ifndef IS_CONSTANT_AST
+#define IS_CONSTANT_AST               IS_CONSTANT_ARRAY
+#endif
+
 #ifndef Z_REFCOUNT_P
 #define Z_REFCOUNT_P(pz)              (pz)->refcount
 #define Z_REFCOUNT_PP(ppz)            Z_REFCOUNT_P(*(ppz))
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Nov 10 16:01:28 2024 UTC