Patch xslcache-php5.4-compat for xslcache Bug #62856
Patch version 2013-03-07 07:32 UTC
Return to Bug #62856 |
Download this patch
Patch Revisions:
Developer: cujo@inbox.ru
diff --git a/php_xsl.c b/php_xsl.c
index 9667fbc..44b7f8f 100755
--- a/php_xsl.c
+++ b/php_xsl.c
@@ -208,7 +208,11 @@ zend_object_value xslcache_objects_new(zend_class_entry *class_type TSRMLS_DC)
intern->doc = NULL;
zend_object_std_init(&intern->std, class_type TSRMLS_CC);
+#if PHP_VERSION_ID < 50399
zend_hash_copy(intern->std.properties, &class_type->default_properties, (copy_ctor_func_t) zval_add_ref, (void *) &tmp, sizeof(zval *));
+#else
+ object_properties_init(&intern->std, class_type);
+#endif
ALLOC_HASHTABLE(intern->parameter);
zend_hash_init(intern->parameter, 0, NULL, ZVAL_PTR_DTOR, 0);
ALLOC_HASHTABLE(intern->registered_phpfunctions);
diff --git a/xsltcache.c b/xsltcache.c
index 02f3f54..3630c7e 100755
--- a/xsltcache.c
+++ b/xsltcache.c
@@ -272,7 +272,11 @@ static void xsl_ext_function_php(xmlXPathParserContextPtr ctxt, int nargs, int t
node->parent = nsparent;
node->ns = curns;
}
+#if PHP_VERSION_ID < 50399
child = php_dom_create_object(node, &ret, NULL, child, domintern TSRMLS_CC);
+#else
+ child = php_dom_create_object(node, &ret, child, domintern TSRMLS_CC);
+#endif
add_next_index_zval(args[i], child);
}
}
@@ -427,7 +431,11 @@ static xmlDocPtr php_xslcache_apply_stylesheet(zval *id, xsl_object *intern, xsl
MAKE_STD_ZVAL(member);
ZVAL_STRING(member, "doXInclude", 0);
+#if PHP_VERSION_ID < 50399
doXInclude = std_hnd->read_property(id, member, BP_VAR_IS TSRMLS_CC);
+#else
+ doXInclude = std_hnd->read_property(id, member, BP_VAR_IS, NULL TSRMLS_CC);
+#endif
if (Z_TYPE_P(doXInclude) != IS_NULL) {
convert_to_long(doXInclude);
ctxt->xinclude = Z_LVAL_P(doXInclude);
@@ -484,7 +492,11 @@ PHP_FUNCTION(xsl_xsltcache_transform_to_doc)
newdocp = php_xslcache_apply_stylesheet(id, intern, sheetp, docp TSRMLS_CC);
if (newdocp) {
+#if PHP_VERSION_ID < 50399
DOM_RET_OBJ(rv, (xmlNodePtr) newdocp, &ret, NULL);
+#else
+ DOM_RET_OBJ((xmlNodePtr) newdocp, &ret, NULL);
+#endif
} else {
RETURN_FALSE;
}
@@ -813,8 +825,13 @@ persist_xsl_object *find_cached_stylesheet(const char *path, int pathlen, zend_b
// look for cached version
int sheet_found = 0;
+#if PHP_VERSION_ID < 50399
list_entry *existing_le;
list_entry le;
+#else
+ zend_rsrc_list_entry *existing_le;
+ zend_rsrc_list_entry le;
+#endif
const char *hash_key = path;
int hash_key_len = pathlen;
@@ -852,7 +869,11 @@ persist_xsl_object *find_cached_stylesheet(const char *path, int pathlen, zend_b
le.type = le_stylesheet;
le.ptr = obj;
+#if PHP_VERSION_ID < 50399
zend_hash_update(&EG(persistent_list), (char *) hash_key, hash_key_len + 1, (void*) &le, sizeof(list_entry), NULL);
+#else
+ zend_hash_update(&EG(persistent_list), (char *) hash_key, hash_key_len + 1, (void*) &le, sizeof(zend_rsrc_list_entry), NULL);
+#endif
}
return obj;
@@ -889,7 +910,11 @@ PHP_FUNCTION(xsl_xsltcache_import_stylesheet)
MAKE_STD_ZVAL(member);
ZVAL_STRING(member, "cloneDocument", 0);
+#if PHP_VERSION_ID < 50399
cloneDocu = std_hnd->read_property(id, member, BP_VAR_IS TSRMLS_CC);
+#else
+ cloneDocu = std_hnd->read_property(id, member, BP_VAR_IS, NULL TSRMLS_CC);
+#endif
if (Z_TYPE_P(cloneDocu) != IS_NULL) {
convert_to_long(cloneDocu);
clone_docu = Z_LVAL_P(cloneDocu);
|