int name_len, value_len, name_valid;
php_set_error_handling(EH_THROW, dom_domexception_class_entry TSRMLS_CC);
- if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os|s", &id, dom_attr_class_entry, &name, &name_len, &value, &value_len) == FAILURE) {
+ if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os&|s&", &id, dom_attr_class_entry, &name, &name_len, UG(utf8_conv), &value, &value_len, UG(utf8_conv)) == FAILURE) {
php_std_error_handling();
return;
}
-
php_std_error_handling();
+
intern = (dom_object *)zend_object_store_get_object(id TSRMLS_CC);
name_valid = xmlValidateName((xmlChar *) name, 0);
RETURN_FALSE;
}
- nodep = xmlNewProp(NULL, (xmlChar *) name, value);
+ nodep = xmlNewProp(NULL, (xmlChar *) name, (xmlChar *) value);
if (!nodep) {
php_dom_throw_error(INVALID_STATE_ERR, 1 TSRMLS_CC);
}
ALLOC_ZVAL(*retval);
- ZVAL_STRING(*retval, (char *) (attrp->name), 1);
+ ZVAL_XML_STRING(*retval, (char *) (attrp->name), ZSTR_DUPLICATE);
return SUCCESS;
}
if ((content = xmlNodeGetContent((xmlNodePtr) attrp)) != NULL) {
- ZVAL_STRING(*retval, content, 1);
+ ZVAL_XML_STRING(*retval, (char *)content, ZSTR_DUPLICATE);
xmlFree(content);
} else {
- ZVAL_EMPTY_STRING(*retval);
+ ZVAL_EMPTY_TEXT(*retval);
}
return SUCCESS;
zval_copy_ctor(&value_copy);
newval = &value_copy;
}
- convert_to_string(newval);
+ convert_to_string_with_converter(newval, UG(utf8_conv));
}
- xmlNodeSetContentLen((xmlNodePtr) attrp, Z_STRVAL_P(newval), Z_STRLEN_P(newval) + 1);
+ xmlNodeSetContentLen((xmlNodePtr) attrp, (xmlChar *) Z_STRVAL_P(newval), Z_STRLEN_P(newval) + 1);
if (newval == &value_copy) {
zval_dtor(newval);
int value_len;
php_set_error_handling(EH_THROW, dom_domexception_class_entry TSRMLS_CC);
- if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &id, dom_cdatasection_class_entry, &value, &value_len) == FAILURE) {
+ if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os&", &id, dom_cdatasection_class_entry, &value, &value_len, UG(utf8_conv)) == FAILURE) {
php_std_error_handling();
return;
}
-
php_std_error_handling();
+
nodep = xmlNewCDataBlock(NULL, (xmlChar *) value, value_len);
if (!nodep) {
ALLOC_ZVAL(*retval);
if ((content = xmlNodeGetContent(nodep)) != NULL) {
- ZVAL_STRING(*retval, content, 1);
+ ZVAL_XML_STRING(*retval, content, ZSTR_DUPLICATE);
xmlFree(content);
} else {
- ZVAL_EMPTY_STRING(*retval);
+ ZVAL_EMPTY_TEXT(*retval);
}
return SUCCESS;
zval_copy_ctor(&value_copy);
newval = &value_copy;
}
- convert_to_string(newval);
+ convert_to_string_with_converter(newval, UG(utf8_conv));
}
xmlNodeSetContentLen(nodep, Z_STRVAL_P(newval), Z_STRLEN_P(newval) + 1);
xmlFree(cur);
if (substring) {
- RETVAL_STRING(substring, 1);
+ RETVAL_XML_STRING(substring, ZSTR_DUPLICATE);
xmlFree(substring);
} else {
- RETVAL_EMPTY_STRING();
+ RETVAL_EMPTY_TEXT();
}
}
/* }}} end dom_characterdata_substring_data */
char *arg;
int arg_len;
- if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &id, dom_characterdata_class_entry, &arg, &arg_len) == FAILURE) {
+ if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os&", &id, dom_characterdata_class_entry, &arg, &arg_len, UG(utf8_conv)) == FAILURE) {
return;
}
int length, arg_len;
dom_object *intern;
- if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Ols", &id, dom_characterdata_class_entry, &offset, &arg, &arg_len) == FAILURE) {
+ if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Ols&", &id, dom_characterdata_class_entry, &offset, &arg, &arg_len, UG(utf8_conv)) == FAILURE) {
return;
}
int length, arg_len;
dom_object *intern;
- if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Olls", &id, dom_characterdata_class_entry, &offset, &count, &arg, &arg_len) == FAILURE) {
+ if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Olls&", &id, dom_characterdata_class_entry, &offset, &count, &arg, &arg_len, UG(utf8_conv)) == FAILURE) {
return;
}
int value_len;
php_set_error_handling(EH_THROW, dom_domexception_class_entry TSRMLS_CC);
- if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O|s", &id, dom_comment_class_entry, &value, &value_len) == FAILURE) {
+ if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O|s&", &id, dom_comment_class_entry, &value, &value_len, UG(utf8_conv)) == FAILURE) {
php_std_error_handling();
return;
}
-
php_std_error_handling();
+
nodep = xmlNewComment((xmlChar *) value);
if (!nodep) {
ALLOC_ZVAL(*retval);
if (encoding != NULL) {
- ZVAL_STRING(*retval, encoding, 1);
+ ZVAL_XML_STRING(*retval, encoding, ZSTR_DUPLICATE);
} else {
ZVAL_NULL(*retval);
}
zval_copy_ctor(&value_copy);
newval = &value_copy;
}
- convert_to_string(newval);
+ convert_to_string_with_converter(newval, UG(utf8_conv));
}
handler = xmlFindCharEncodingHandler(Z_STRVAL_P(newval));
ALLOC_ZVAL(*retval);
if (version != NULL) {
- ZVAL_STRING(*retval, version, 1);
+ ZVAL_XML_STRING(*retval, version, ZSTR_DUPLICATE);
} else {
ZVAL_NULL(*retval);
}
zval_copy_ctor(&value_copy);
newval = &value_copy;
}
- convert_to_string(newval);
+ convert_to_string_with_converter(newval, UG(utf8_conv));
}
docp->version = xmlStrdup((const xmlChar *) Z_STRVAL_P(newval));
ALLOC_ZVAL(*retval);
url = (char *) docp->URL;
if (url != NULL) {
- ZVAL_STRING(*retval, url, 1);
+ ZVAL_XML_STRING(*retval, url, ZSTR_DUPLICATE);
} else {
ZVAL_NULL(*retval);
}
zval_copy_ctor(&value_copy);
newval = &value_copy;
}
- convert_to_string(newval);
+ convert_to_string_with_converter(newval, UG(utf8_conv));
}
docp->URL = xmlStrdup((const xmlChar *) Z_STRVAL_P(newval));
int ret, name_len, value_len;
char *name, *value = NULL;
- if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os|s", &id, dom_document_class_entry, &name, &name_len, &value, &value_len) == FAILURE) {
+ if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os&|s&", &id, dom_document_class_entry, &name, &name_len, UG(utf8_conv), &value, &value_len, UG(utf8_conv)) == FAILURE) {
return;
}
dom_object *intern;
char *value;
- if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &id, dom_document_class_entry, &value, &value_len) == FAILURE) {
+ if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os&", &id, dom_document_class_entry, &value, &value_len, UG(utf8_conv)) == FAILURE) {
return;
}
dom_object *intern;
char *value;
- if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &id, dom_document_class_entry, &value, &value_len) == FAILURE) {
+ if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os&", &id, dom_document_class_entry, &value, &value_len, UG(utf8_conv)) == FAILURE) {
return;
}
dom_object *intern;
char *value;
- if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &id, dom_document_class_entry, &value, &value_len) == FAILURE) {
+ if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os&", &id, dom_document_class_entry, &value, &value_len, UG(utf8_conv)) == FAILURE) {
return;
}
dom_object *intern;
char *name, *value = NULL;
- if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os|s", &id, dom_document_class_entry, &name, &name_len, &value, &value_len) == FAILURE) {
+ if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os&|s&", &id, dom_document_class_entry, &name, &name_len, UG(utf8_conv), &value, &value_len, UG(utf8_conv)) == FAILURE) {
return;
}
dom_object *intern;
char *name;
- if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &id, dom_document_class_entry, &name, &name_len) == FAILURE) {
+ if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os&", &id, dom_document_class_entry, &name, &name_len, UG(utf8_conv)) == FAILURE) {
return;
}
int ret, name_len;
char *name;
- if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &id, dom_document_class_entry, &name, &name_len) == FAILURE) {
+ if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os&", &id, dom_document_class_entry, &name, &name_len, UG(utf8_conv)) == FAILURE) {
return;
}
char *name;
xmlChar *local;
- if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &id, dom_document_class_entry, &name, &name_len) == FAILURE) {
+ if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os&", &id, dom_document_class_entry, &name, &name_len, UG(utf8_conv)) == FAILURE) {
return;
}
int errorcode;
dom_object *intern;
- if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os!s|s", &id, dom_document_class_entry, &uri, &uri_len, &name, &name_len, &value, &value_len) == FAILURE) {
+ if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os!&s&|s&", &id, dom_document_class_entry, &uri, &uri_len, UG(utf8_conv), &name, &name_len, UG(utf8_conv), &value, &value_len, UG(utf8_conv)) == FAILURE) {
return;
}
dom_object *intern;
int errorcode;
- if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os!s", &id, dom_document_class_entry, &uri, &uri_len, &name, &name_len) == FAILURE) {
+ if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os!&s&", &id, dom_document_class_entry, &uri, &uri_len, UG(utf8_conv), &name, &name_len, UG(utf8_conv)) == FAILURE) {
return;
}
char *uri, *name;
xmlChar *local, *nsuri;
- if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oss", &id, dom_document_class_entry, &uri, &uri_len, &name, &name_len) == FAILURE) {
+ if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os&s&", &id, dom_document_class_entry, &uri, &uri_len, UG(utf8_conv), &name, &name_len, UG(utf8_conv)) == FAILURE) {
return;
}
dom_object *intern;
char *idname;
- if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &id, dom_document_class_entry, &idname, &idname_len) == FAILURE) {
+ if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os&", &id, dom_document_class_entry, &idname, &idname_len, UG(utf8_conv)) == FAILURE) {
return;
}
int encoding_len = 0, version_len = 0, refcount;
php_set_error_handling(EH_THROW, dom_domexception_class_entry TSRMLS_CC);
- if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O|ss", &id, dom_document_class_entry, &version, &version_len, &encoding, &encoding_len) == FAILURE) {
+ if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O|s&s&", &id, dom_document_class_entry, &version, &version_len, UG(utf8_conv), &encoding, &encoding_len, UG(utf8_conv)) == FAILURE) {
php_std_error_handling();
return;
}
-
php_std_error_handling();
+
docp = xmlNewDoc(version);
if (!docp) {
dom_object *intern;
char *source;
int source_len, refcount, ret;
+ zend_uchar source_type = IS_STRING;
long options = 0;
id = getThis();
id = NULL;
}
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &source, &source_len, &options) == FAILURE) {
- return;
+ if (mode == DOM_LOAD_FILE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "t|l", &source, &source_len, &source_type, &options) == FAILURE) {
+ return;
+ }
+ } else {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &source, &source_len, &options) == FAILURE) {
+ return;
+ }
}
if (!source_len) {
RETURN_FALSE;
}
+ if (source_type == IS_UNICODE) {
+ if (php_stream_path_encode(NULL, &source, &source_len, (UChar*)source, source_len, REPORT_ERRORS, NULL) == FAILURE) {
+ RETURN_FALSE;
+ }
+ }
+
newdoc = dom_document_parser(id, mode, source, options TSRMLS_CC);
+ if (source_type == IS_UNICODE) {
+ efree(source);
+ }
+
if (!newdoc)
RETURN_FALSE;
dom_object *intern;
dom_doc_propsptr doc_props;
char *file;
+ zend_uchar file_type;
long options = 0;
- if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os|l", &id, dom_document_class_entry, &file, &file_len, &options) == FAILURE) {
+ if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Ot|l", &id, dom_document_class_entry, &file, &file_len, &file_type, &options) == FAILURE) {
return;
}
saveempty = xmlSaveNoEmptyTags;
xmlSaveNoEmptyTags = 1;
}
+
+ if (file_type == IS_UNICODE) {
+ if (php_stream_path_encode(NULL, &file, &file_len, (UChar*)file, file_len, REPORT_ERRORS, NULL) == FAILURE) {
+ RETURN_FALSE;
+ }
+ }
+
bytes = xmlSaveFormatFileEnc(file, docp, NULL, format);
+
+ if (file_type == IS_UNICODE) {
+ efree(file);
+ }
+
if (options & LIBXML_SAVE_NOEMPTYTAG) {
xmlSaveNoEmptyTags = saveempty;
}
if (!size) {
RETURN_FALSE;
}
- RETVAL_RT_STRINGL(mem, size, 1);
+ RETVAL_STRINGL(mem, size, 1);
xmlFree(mem);
}
}
xmlSchemaValidCtxtPtr vptr;
int is_valid;
char resolved_path[MAXPATHLEN + 1];
+ zend_uchar source_type = IS_STRING;
- if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &id, dom_document_class_entry, &source, &source_len) == FAILURE) {
- return;
+ if (type == DOM_LOAD_FILE) {
+ if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &id, dom_document_class_entry, &source, &source_len, &source_type) == FAILURE) {
+ return;
+ }
+ } else {
+ if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &id, dom_document_class_entry, &source, &source_len) == FAILURE) {
+ return;
+ }
}
if (source_len == 0) {
switch (type) {
case DOM_LOAD_FILE:
+ if (source_type == IS_UNICODE) {
+ if (php_stream_path_encode(NULL, &source, &source_len, (UChar*)source, source_len, REPORT_ERRORS, NULL) == FAILURE) {
+ RETURN_FALSE;
+ }
+ }
+
valid_file = _dom_get_valid_file_path(source, resolved_path, MAXPATHLEN TSRMLS_CC);
if (!valid_file) {
+ if (source_type == IS_UNICODE) {
+ efree(source);
+ }
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid Schema file source");
RETURN_FALSE;
}
parser = xmlSchemaNewParserCtxt(valid_file);
+
+ if (source_type == IS_UNICODE) {
+ efree(source);
+ }
break;
case DOM_LOAD_STRING:
parser = xmlSchemaNewMemParserCtxt(source, source_len);
xmlRelaxNGValidCtxtPtr vptr;
int is_valid;
char resolved_path[MAXPATHLEN + 1];
+ zend_uchar source_type = IS_STRING;
- if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &id, dom_document_class_entry, &source, &source_len) == FAILURE) {
- return;
+ if (type == DOM_LOAD_FILE) {
+ if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &id, dom_document_class_entry, &source, &source_len, &source_type) == FAILURE) {
+ return;
+ }
+ } else {
+ if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &id, dom_document_class_entry, &source, &source_len) == FAILURE) {
+ return;
+ }
}
if (source_len == 0) {
switch (type) {
case DOM_LOAD_FILE:
+ if (source_type == IS_UNICODE) {
+ if (php_stream_path_encode(NULL, &source, &source_len, (UChar*)source, source_len, REPORT_ERRORS, NULL) == FAILURE) {
+ RETURN_FALSE;
+ }
+ }
valid_file = _dom_get_valid_file_path(source, resolved_path, MAXPATHLEN TSRMLS_CC);
if (!valid_file) {
+ if (source_type == IS_UNICODE) {
+ efree(source);
+ }
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid RelaxNG file source");
RETURN_FALSE;
}
parser = xmlRelaxNGNewParserCtxt(valid_file);
+ if (source_type == IS_UNICODE) {
+ efree(source);
+ }
break;
case DOM_LOAD_STRING:
parser = xmlRelaxNGNewMemParserCtxt(source, source_len);
char *source;
int source_len, refcount, ret;
htmlParserCtxtPtr ctxt;
-
+ zend_uchar source_type = IS_STRING;
+
id = getThis();
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &source, &source_len) == FAILURE) {
- return;
+ if (mode == DOM_LOAD_FILE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &source, &source_len, &source_type) == FAILURE) {
+ return;
+ }
+ } else {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &source, &source_len) == FAILURE) {
+ return;
+ }
}
if (!source_len) {
}
if (mode == DOM_LOAD_FILE) {
+ if (source_type == IS_UNICODE) {
+ if (php_stream_path_encode(NULL, &source, &source_len, (UChar*)source, source_len, REPORT_ERRORS, NULL) == FAILURE) {
+ RETURN_FALSE;
+ }
+ }
+
ctxt = htmlCreateFileParserCtxt(source, NULL);
+
+ if (source_type == IS_UNICODE) {
+ efree(source);
+ }
} else {
source_len = xmlStrlen(source);
ctxt = htmlCreateMemoryParserCtxt(source, source_len);
dom_object *intern;
dom_doc_propsptr doc_props;
char *file;
+ zend_uchar file_type = IS_STRING;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &id, dom_document_class_entry, &file, &file_len) == FAILURE) {
return;
DOM_GET_OBJ(docp, id, xmlDocPtr, intern);
+ if (file_type == IS_UNICODE) {
+ if (php_stream_path_encode(NULL, &file, &file_len, (UChar*)file, file_len, REPORT_ERRORS, NULL) == FAILURE) {
+ RETURN_FALSE;
+ }
+ }
+
/* encoding handled by property on doc */
doc_props = dom_get_doc_props(intern->document);
format = doc_props->formatoutput;
+
bytes = htmlSaveFileFormat(file, docp, NULL, format);
+ if (file_type == IS_UNICODE) {
+ efree(file);
+ }
+
if (bytes == -1) {
RETURN_FALSE;
}
int err;
xmlNodePtr lst;
- if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &id, dom_documentfragment_class_entry, &data, &data_len) == FAILURE) {
+ if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os&", &id, dom_documentfragment_class_entry, &data, &data_len, UG(utf8_conv)) == FAILURE) {
return;
}
xmlChar *pch1 = NULL, *pch2 = NULL, *localname = NULL;
xmlURIPtr uri;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|sss", &name, &name_len, &publicid, &publicid_len, &systemid, &systemid_len) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s&s&s&", &name, &name_len, UG(utf8_conv), &publicid, &publicid_len, UG(utf8_conv), &systemid, &systemid_len, UG(utf8_conv)) == FAILURE) {
return;
}
char *prefix = NULL, *localname = NULL;
dom_object *doctobj;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|ssO", &uri, &uri_len, &name, &name_len, &node, dom_documenttype_class_entry) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s&s&O", &uri, &uri_len, UG(utf8_conv), &name, &name_len, UG(utf8_conv), &node, dom_documenttype_class_entry) == FAILURE) {
return;
}
xmlNsPtr nsptr = NULL;
php_set_error_handling(EH_THROW, dom_domexception_class_entry TSRMLS_CC);
- if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os|s!s", &id, dom_element_class_entry, &name, &name_len, &value, &value_len, &uri, &uri_len) == FAILURE) {
+ if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os&|s!&s&", &id, dom_element_class_entry, &name, &name_len, UG(utf8_conv), &value, &value_len, UG(utf8_conv), &uri, &uri_len, UG(utf8_conv)) == FAILURE) {
php_std_error_handling();
return;
}
-
php_std_error_handling();
+
name_valid = xmlValidateName((xmlChar *) name, 0);
if (name_valid != 0) {
php_dom_throw_error(INVALID_CHARACTER_ERR, 1 TSRMLS_CC);
qname = xmlStrdup(ns->prefix);
qname = xmlStrcat(qname, ":");
qname = xmlStrcat(qname, nodep->name);
- ZVAL_STRING(*retval, qname, 1);
+ ZVAL_XML_STRING(*retval, qname, ZSTR_DUPLICATE);
xmlFree(qname);
} else {
- ZVAL_STRING(*retval, (char *) nodep->name, 1);
+ ZVAL_XML_STRING(*retval, (char *) nodep->name, ZSTR_DUPLICATE);
}
return SUCCESS;
value = xmlGetProp(nodep, name);
if (value == NULL) {
- RETURN_EMPTY_STRING();
+ RETURN_EMPTY_TEXT();
} else {
- RETVAL_STRING(value, 1);
+ RETVAL_XML_STRING(value, ZSTR_DUPLICATE);
xmlFree(value);
}
}
dom_object *intern;
char *name, *value;
-
- if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oss", &id, dom_element_class_entry, &name, &name_len, &value, &value_len) == FAILURE) {
+ if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os&s&", &id, dom_element_class_entry, &name, &name_len, UG(utf8_conv), &value, &value_len, UG(utf8_conv)) == FAILURE) {
return;
}
int name_len;
char *name;
- if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &id, dom_element_class_entry, &name, &name_len) == FAILURE) {
+ if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os&", &id, dom_element_class_entry, &name, &name_len, UG(utf8_conv)) == FAILURE) {
return;
}
dom_object *intern;
char *name;
- if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &id, dom_element_class_entry, &name, &name_len) == FAILURE) {
+ if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os&", &id, dom_element_class_entry, &name, &name_len, UG(utf8_conv)) == FAILURE) {
return;
}
char *name;
xmlChar *local;
- if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &id, dom_element_class_entry, &name, &name_len) == FAILURE) {
+ if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os&", &id, dom_element_class_entry, &name, &name_len, UG(utf8_conv)) == FAILURE) {
return;
}
int uri_len = 0, name_len = 0;
char *uri, *name, *strattr;
- if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os!s", &id, dom_element_class_entry, &uri, &uri_len, &name, &name_len) == FAILURE) {
+ if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os!&s&", &id, dom_element_class_entry, &uri, &uri_len, UG(utf8_conv), &name, &name_len, UG(utf8_conv)) == FAILURE) {
return;
}
strattr = xmlGetNsProp(elemp, name, uri);
if (strattr != NULL) {
- RETVAL_STRING(strattr, 1);
+ RETVAL_XML_STRING(strattr, ZSTR_DUPLICATE);
xmlFree(strattr);
} else {
if (xmlStrEqual(uri, DOM_XMLNS_NAMESPACE)) {
nsptr = dom_get_nsdecl(elemp, name);
if (nsptr != NULL) {
- RETVAL_STRING((char *) nsptr->href, 1);
+ RETVAL_XML_STRING((char *) nsptr->href, ZSTR_DUPLICATE);
} else {
- RETVAL_EMPTY_STRING();
+ RETVAL_EMPTY_TEXT();
}
} else {
- RETVAL_EMPTY_STRING();
+ RETVAL_EMPTY_TEXT();
}
}
dom_object *intern;
int errorcode = 0, stricterror, is_xmlns = 0;
- if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os!ss", &id, dom_element_class_entry, &uri, &uri_len, &name, &name_len, &value, &value_len) == FAILURE) {
+ if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os!&s&s&", &id, dom_element_class_entry, &uri, &uri_len, UG(utf8_conv), &name, &name_len, UG(utf8_conv), &value, &value_len, UG(utf8_conv)) == FAILURE) {
return;
}
int name_len, uri_len;
char *name, *uri;
- if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os!s", &id, dom_element_class_entry, &uri, &uri_len, &name, &name_len) == FAILURE) {
+ if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os!&s&", &id, dom_element_class_entry, &uri, &uri_len, UG(utf8_conv), &name, &name_len, UG(utf8_conv)) == FAILURE) {
return;
}
int uri_len, name_len, ret;
char *uri, *name;
- if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os!s", &id, dom_element_class_entry, &uri, &uri_len, &name, &name_len) == FAILURE) {
+ if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os!&s&", &id, dom_element_class_entry, &uri, &uri_len, UG(utf8_conv), &name, &name_len, UG(utf8_conv)) == FAILURE) {
return;
}
char *uri, *name;
xmlChar *local, *nsuri;
- if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oss", &id, dom_element_class_entry, &uri, &uri_len, &name, &name_len) == FAILURE) {
+ if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os&s&", &id, dom_element_class_entry, &uri, &uri_len, UG(utf8_conv), &name, &name_len, UG(utf8_conv)) == FAILURE) {
return;
}
char *name, *value;
int name_len;
- if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &id, dom_element_class_entry, &name, &name_len) == FAILURE) {
+ if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os&", &id, dom_element_class_entry, &name, &name_len, UG(utf8_conv)) == FAILURE) {
return;
}
int uri_len, name_len;
char *uri, *name, *value;
- if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os!s", &id, dom_element_class_entry, &uri, &uri_len, &name, &name_len) == FAILURE) {
+ if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os!&s&", &id, dom_element_class_entry, &uri, &uri_len, UG(utf8_conv), &name, &name_len, UG(utf8_conv)) == FAILURE) {
return;
}
int name_len;
zend_bool is_id;
- if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Osb", &id, dom_element_class_entry, &name, &name_len, &is_id) == FAILURE) {
+ if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os&b", &id, dom_element_class_entry, &name, &name_len, UG(utf8_conv), &is_id) == FAILURE) {
return;
}
char *uri, *name;
zend_bool is_id;
- if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Ossb", &id, dom_element_class_entry, &uri, &uri_len, &name, &name_len, &is_id) == FAILURE) {
+ if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os&s&b", &id, dom_element_class_entry, &uri, &uri_len, UG(utf8_conv), &name, &name_len, UG(utf8_conv), &is_id) == FAILURE) {
return;
}
if (nodep->etype != XML_EXTERNAL_GENERAL_UNPARSED_ENTITY) {
ZVAL_NULL(*retval);
} else {
- ZVAL_STRING(*retval, (char *) (nodep->ExternalID), 1);
+ ZVAL_XML_STRING(*retval, (char *) (nodep->ExternalID), ZSTR_DUPLICATE);
}
return SUCCESS;
if (nodep->etype != XML_EXTERNAL_GENERAL_UNPARSED_ENTITY) {
ZVAL_NULL(*retval);
} else {
- ZVAL_STRING(*retval, (char *) (nodep->SystemID), 1);
+ ZVAL_XML_STRING(*retval, (char *) (nodep->SystemID), ZSTR_DUPLICATE);
}
return SUCCESS;
ZVAL_NULL(*retval);
} else {
content = xmlNodeGetContent((xmlNodePtr) nodep);
- ZVAL_STRING(*retval, content, 1);
+ ZVAL_XML_STRING(*retval, content, ZSTR_DUPLICATE);
xmlFree(content);
}
int name_len, name_valid;
php_set_error_handling(EH_THROW, dom_domexception_class_entry TSRMLS_CC);
- if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &id, dom_entityreference_class_entry, &name, &name_len) == FAILURE) {
+ if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os&", &id, dom_entityreference_class_entry, &name, &name_len, UG(utf8_conv)) == FAILURE) {
php_std_error_handling();
return;
}
-
php_std_error_handling();
name_valid = xmlValidateName((xmlChar *) name, 0);
xmlNodePtr nodep;
xmlNotation *notep = NULL;
- if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &id, dom_namednodemap_class_entry, &named, &namedlen) == FAILURE) {
+ if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os&", &id, dom_namednodemap_class_entry, &named, &namedlen, UG(utf8_conv)) == FAILURE) {
return;
}
xmlNodePtr nodep;
xmlNotation *notep = NULL;
- if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os!s", &id, dom_namednodemap_class_entry, &uri, &urilen, &named, &namedlen) == FAILURE) {
+ if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os!&s&", &id, dom_namednodemap_class_entry, &uri, &urilen, UG(utf8_conv), &named, &namedlen, UG(utf8_conv)) == FAILURE) {
return;
}
ALLOC_ZVAL(*retval);
if(str != NULL) {
- ZVAL_RT_STRING(*retval, str, 1);
+ ZVAL_XML_STRING(*retval, str, ZSTR_DUPLICATE);
} else {
ZVAL_EMPTY_TEXT(*retval);
}
ALLOC_ZVAL(*retval);
if(str != NULL) {
- ZVAL_RT_STRING(*retval, str, 1);
+ ZVAL_XML_STRING(*retval, str, ZSTR_DUPLICATE);
xmlFree(str);
} else {
ZVAL_NULL(*retval);
zval_copy_ctor(&value_copy);
newval = &value_copy;
}
- convert_to_string(newval);
+ convert_to_string_with_converter(newval, UG(utf8_conv));
}
xmlNodeSetContentLen(nodep, Z_STRVAL_P(newval), Z_STRLEN_P(newval) + 1);
if (newval == &value_copy) {
ALLOC_ZVAL(*retval);
if(str != NULL) {
- ZVAL_STRING(*retval, str, 1);
+ ZVAL_XML_STRING(*retval, str, ZSTR_DUPLICATE);
} else {
ZVAL_NULL(*retval);
}
ALLOC_ZVAL(*retval);
if (str == NULL) {
- ZVAL_EMPTY_STRING(*retval);
+ ZVAL_EMPTY_TEXT(*retval);
} else {
- ZVAL_STRING(*retval, str, 1);
+ ZVAL_XML_STRING(*retval, str, ZSTR_DUPLICATE);
}
return SUCCESS;
zval_copy_ctor(&value_copy);
newval = &value_copy;
}
- convert_to_string(newval);
+ convert_to_string_with_converter(newval, UG(utf8_conv));
}
prefix = Z_STRVAL_P(newval);
if (nsnode && nodep->ns != NULL && !xmlStrEqual(nodep->ns->prefix, (xmlChar *)prefix)) {
ALLOC_ZVAL(*retval);
if (nodep->type == XML_ELEMENT_NODE || nodep->type == XML_ATTRIBUTE_NODE || nodep->type == XML_NAMESPACE_DECL) {
- ZVAL_STRING(*retval, (char *) (nodep->name), 1);
+ ZVAL_XML_STRING(*retval, (char *) (nodep->name), ZSTR_DUPLICATE);
} else {
ZVAL_NULL(*retval);
}
baseuri = xmlNodeGetBase(nodep->doc, nodep);
if (baseuri) {
- ZVAL_STRING(*retval, (char *) (baseuri), 1);
+ ZVAL_XML_STRING(*retval, (char *) (baseuri), ZSTR_DUPLICATE);
xmlFree(baseuri);
} else {
ZVAL_NULL(*retval);
ALLOC_ZVAL(*retval);
if(str != NULL) {
- ZVAL_STRING(*retval, str, 1);
+ ZVAL_XML_STRING(*retval, str, ZSTR_DUPLICATE);
xmlFree(str);
} else {
- ZVAL_EMPTY_STRING(*retval);
+ ZVAL_EMPTY_TEXT(*retval);
}
return SUCCESS;
int uri_len = 0;
char *uri;
- if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &id, dom_node_class_entry, &uri, &uri_len) == FAILURE) {
+ if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os&", &id, dom_node_class_entry, &uri, &uri_len, UG(utf8_conv)) == FAILURE) {
return;
}
if (lookupp != NULL && (nsptr = xmlSearchNsByHref(lookupp->doc, lookupp, uri))) {
if (nsptr->prefix != NULL) {
- RETURN_STRING((char *) nsptr->prefix, 1);
+ RETVAL_XML_STRING((char *) nsptr->prefix, ZSTR_DUPLICATE);
+ return;
}
}
}
int uri_len = 0;
char *uri;
- if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &id, dom_node_class_entry, &uri, &uri_len) == FAILURE) {
+ if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os&", &id, dom_node_class_entry, &uri, &uri_len, UG(utf8_conv)) == FAILURE) {
return;
}
int prefix_len = 0;
char *prefix;
- if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &id, dom_node_class_entry, &prefix, &prefix_len) == FAILURE) {
+ if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os&", &id, dom_node_class_entry, &prefix, &prefix_len, UG(utf8_conv)) == FAILURE) {
return;
}
if (prefix_len > 0) {
nsptr = xmlSearchNs(nodep->doc, nodep, prefix);
if (nsptr && nsptr->href != NULL) {
- RETURN_STRING((char *) nsptr->href, 1);
+ RETVAL_XML_STRING((char *) nsptr->href, ZSTR_DUPLICATE);
+ return;
}
}
xmlOutputBufferPtr buf;
xmlXPathContextPtr ctxp=NULL;
xmlXPathObjectPtr xpathobjp=NULL;
+ zend_uchar file_type = IS_STRING;
if (mode == 0) {
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(),
}
} else {
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(),
- "Os|bba!a!", &id, dom_node_class_entry, &file, &file_len, &exclusive,
+ "Ot|bba!a!", &id, dom_node_class_entry, &file, &file_len, &file_type, &exclusive,
&with_comments, &xpath_array, &ns_prefixes) == FAILURE) {
return;
}
RETURN_FALSE;
}
+ if (file_type == IS_UNICODE) {
+ if (php_stream_path_encode(NULL, &file, &file_len, (UChar*)file, file_len, REPORT_ERRORS, NULL) == FAILURE) {
+ RETURN_FALSE;
+ }
+ }
+
if (xpath_array == NULL) {
if (nodep->type != XML_DOCUMENT_NODE) {
ctxp = xmlXPathNewContext(docp);
xmlXPathFreeObject(xpathobjp);
}
xmlXPathFreeContext(ctxp);
+ if (file_type == IS_UNICODE) {
+ efree(file);
+ }
php_error_docref(NULL TSRMLS_CC, E_WARNING, "XPath query did not return a nodeset.");
RETURN_FALSE;
}
} else {
/*xpath query from xpath_array */
HashTable *ht = Z_ARRVAL_P(xpath_array);
- zval **tmp;
+ zval **tmp, **zxquery;
char *xquery;
+ int xquery_len;
if (zend_hash_find(ht, "query", sizeof("query"), (void**)&tmp) == SUCCESS &&
- Z_TYPE_PP(tmp) == IS_STRING) {
- xquery = Z_STRVAL_PP(tmp);
+ Z_TYPE_PP(tmp) == IS_STRING || Z_TYPE_PP(tmp) == IS_UNICODE) {
+ zxquery = tmp;
+/*
+ if (Z_TYPE_PP(tmp) == IS_STRING) {
+ xquery = Z_STRVAL_PP(tmp);
+ } else {
+
+ }
+*/
} else {
+ if (file_type == IS_UNICODE) {
+ efree(file);
+ }
php_error_docref(NULL TSRMLS_CC, E_WARNING, "'query' missing from xpath array or is not a string");
RETURN_FALSE;
}
if (zend_hash_find(ht, "namespaces", sizeof("namespaces"), (void**)&tmp) == SUCCESS &&
Z_TYPE_PP(tmp) == IS_ARRAY) {
zval **tmpns;
+ char *nschar;
+ int nschar_len;
+
while (zend_hash_get_current_data(Z_ARRVAL_PP(tmp), (void **)&tmpns) == SUCCESS) {
- if (Z_TYPE_PP(tmpns) == IS_STRING) {
- char *prefix;
+ if (Z_TYPE_PP(tmpns) == IS_STRING || Z_TYPE_PP(tmpns) == IS_UNICODE) {
+ zstr prefix = NULL_ZSTR;
ulong idx;
- int prefix_key_len;
+ uint prefix_key_len;
+ zend_uchar htype;
+ UErrorCode errCode = 0;
+
+ if (Z_TYPE_PP(tmpns) == IS_UNICODE) {
+ zend_convert_from_unicode(UG(utf8_conv), &nschar, &nschar_len, Z_USTRVAL_PP(tmpns), Z_USTRLEN_PP(tmpns), &errCode);
+ } else {
+ nschar = Z_STRVAL_PP(tmpns);
+ }
+
+ htype = zend_hash_get_current_key_ex(Z_ARRVAL_PP(tmp),
+ &prefix, &prefix_key_len, &idx, 0, NULL);
+ if (htype == HASH_KEY_IS_STRING) {
+ xmlXPathRegisterNs(ctxp, (xmlChar *)prefix.s, (xmlChar *)nschar);
+ } else
+ if (htype == HASH_KEY_IS_UNICODE) {
+ char *tmp_prefix;
+ int tmp_prefix_len;
+ errCode = 0;
+
+ zend_convert_from_unicode(UG(utf8_conv), &tmp_prefix, &tmp_prefix_len, prefix.u, prefix_key_len, &errCode);
+ xmlXPathRegisterNs(ctxp, (xmlChar *)tmp_prefix, (xmlChar *)nschar);
+ efree(tmp_prefix);
+ }
- if (zend_hash_get_current_key_ex(Z_ARRVAL_PP(tmp),
- &prefix, &prefix_key_len, &idx, 0, NULL) == HASH_KEY_IS_STRING) {
- xmlXPathRegisterNs(ctxp, prefix, Z_STRVAL_PP(tmpns));
+ if (Z_TYPE_PP(tmpns) == IS_UNICODE) {
+ efree(nschar);
}
}
zend_hash_move_forward(Z_ARRVAL_PP(tmp));
}
}
+ if (Z_TYPE_PP(zxquery) == IS_UNICODE) {
+ UErrorCode errCode = 0;
+ zend_convert_from_unicode(UG(utf8_conv), &xquery, &xquery_len, Z_USTRVAL_PP(zxquery), Z_USTRLEN_PP(zxquery), &errCode);
+ } else {
+ xquery = Z_STRVAL_PP(zxquery);
+ }
+
xpathobjp = xmlXPathEvalExpression(xquery, ctxp);
+
+ if (Z_TYPE_PP(zxquery) == IS_UNICODE) {
+ efree(xquery);
+ }
+
ctxp->node = NULL;
if (xpathobjp && xpathobjp->type == XPATH_NODESET) {
nodeset = xpathobjp->nodesetval;
} else {
+ if (file_type == IS_UNICODE) {
+ efree(file);
+ }
if (xpathobjp) {
xmlXPathFreeObject(xpathobjp);
}
sizeof(xmlChar *), 0);
while (zend_hash_get_current_data(Z_ARRVAL_P(ns_prefixes), (void **)&tmpns) == SUCCESS) {
if (Z_TYPE_PP(tmpns) == IS_STRING) {
- inclusive_ns_prefixes[nscount++] = Z_STRVAL_PP(tmpns);
+ inclusive_ns_prefixes[nscount++] = estrndup(Z_STRVAL_PP(tmpns), strlen(Z_STRVAL_PP(tmpns)));
+ } else {
+ UErrorCode errCode = 0;
+ char *prefix;
+ int prfeix_len;
+
+ zend_convert_from_unicode(UG(utf8_conv), &prefix, &prfeix_len, Z_USTRVAL_PP(tmpns), Z_USTRLEN_PP(tmpns), &errCode);
+ inclusive_ns_prefixes[nscount++] = prefix;
}
zend_hash_move_forward(Z_ARRVAL_P(ns_prefixes));
}
with_comments, buf);
}
+ if (file_type == IS_UNICODE) {
+ efree(file);
+ }
+
if (inclusive_ns_prefixes != NULL) {
+ int nscount = 0;
+ while(inclusive_ns_prefixes[nscount] != NULL) {
+ efree(inclusive_ns_prefixes[nscount++]);
+ }
efree(inclusive_ns_prefixes);
}
if (xpathobjp != NULL) {
DOM_GET_THIS_OBJ(nodep, id, xmlNodePtr, intern);
- value = xmlGetNodePath(nodep);
+ value = (char *)xmlGetNodePath(nodep);
if (value == NULL) {
RETURN_NULL();
} else {
- RETVAL_STRING(value, 1);
+ RETVAL_XML_STRING(value, ZSTR_DUPLICATE);
xmlFree(value);
}
ALLOC_ZVAL(*retval);
if (nodep->ExternalID) {
- ZVAL_STRING(*retval, (char *) (nodep->ExternalID), 1);
+ ZVAL_XML_STRING(*retval, (char *) (nodep->ExternalID), ZSTR_DUPLICATE);
} else {
- ZVAL_EMPTY_STRING(*retval);
+ ZVAL_EMPTY_TEXT(*retval);
}
return SUCCESS;
ALLOC_ZVAL(*retval);
if (nodep->SystemID) {
- ZVAL_STRING(*retval, (char *) (nodep->SystemID), 1);
+ ZVAL_XML_STRING(*retval, (char *) (nodep->SystemID), ZSTR_DUPLICATE);
} else {
- ZVAL_EMPTY_STRING(*retval);
+ ZVAL_EMPTY_TEXT(*retval);
}
return SUCCESS;
int name_len, value_len, name_valid;
php_set_error_handling(EH_THROW, dom_domexception_class_entry TSRMLS_CC);
- if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os|s", &id, dom_processinginstruction_class_entry, &name, &name_len, &value, &value_len) == FAILURE) {
+ if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os&|s&", &id, dom_processinginstruction_class_entry, &name, &name_len, UG(utf8_conv), &value, &value_len, UG(utf8_conv)) == FAILURE) {
php_std_error_handling();
return;
}
-
php_std_error_handling();
name_valid = xmlValidateName((xmlChar *) name, 0);
}
ALLOC_ZVAL(*retval);
- ZVAL_STRING(*retval, (char *) (nodep->name), 1);
+ ZVAL_XML_STRING(*retval, (char *) (nodep->name), ZSTR_DUPLICATE);
return SUCCESS;
}
if ((content = xmlNodeGetContent(nodep)) != NULL) {
- ZVAL_STRING(*retval, content, 1);
+ ZVAL_XML_STRING(*retval, content, ZSTR_DUPLICATE);
xmlFree(content);
} else {
- ZVAL_EMPTY_STRING(*retval);
+ ZVAL_EMPTY_TEXT(*retval);
}
return SUCCESS;
zval_copy_ctor(&value_copy);
newval = &value_copy;
}
- convert_to_string(newval);
+ convert_to_string_with_converter(newval, UG(utf8_conv));
}
xmlNodeSetContentLen(nodep, Z_STRVAL_P(newval), Z_STRLEN_P(newval) + 1);
string(5) "attrc"
<?xml version="1.0" encoding="ISO-8859-1"?>
<foo xmlns="http://www.example.com/ns/foo" xmlns:fubar="http://www.example.com/ns/fubar" xmlns:default="http://www.example.com/ns/foo" attra="attra" default:attra="attranew" fubar:attrb="attrbnew" default:attrc="attrc"/>
+--UEXPECT--
+bool(false)
+unicode(0) ""
+unicode(8) "attranew"
+unicode(8) "attrbnew"
+unicode(5) "attrc"
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<foo xmlns="http://www.example.com/ns/foo" xmlns:fubar="http://www.example.com/ns/fubar" xmlns:default="http://www.example.com/ns/foo" attra="attra" default:attra="attranew" fubar:attrb="attrbnew" default:attrc="attrc"/>
int value_len;
php_set_error_handling(EH_THROW, dom_domexception_class_entry TSRMLS_CC);
- if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O|s", &id, dom_text_class_entry, &value, &value_len) == FAILURE) {
+ if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O|s&", &id, dom_text_class_entry, &value, &value_len, UG(utf8_conv)) == FAILURE) {
php_std_error_handling();
return;
}
-
php_std_error_handling();
+
nodep = xmlNewText((xmlChar *) value);
if (!nodep) {
ALLOC_ZVAL(*retval);
wholetext = xmlNodeListGetString(node->doc, node, 1);
- ZVAL_STRING(*retval, wholetext, 1);
+ ZVAL_XML_STRING(*retval, wholetext, ZSTR_DUPLICATE);
xmlFree(wholetext);
dom_object *intern;
unsigned char *prefix, *ns_uri;
- if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oss", &id, dom_xpath_class_entry, &prefix, &prefix_len, &ns_uri, &ns_uri_len) == FAILURE) {
+ if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os&s&", &id, dom_xpath_class_entry, &prefix, &prefix_len, UG(utf8_conv), &ns_uri, &ns_uri_len, UG(utf8_conv)) == FAILURE) {
return;
}
xmlDoc *docp = NULL;
xmlNsPtr *ns;
-
- if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os|O", &id, dom_xpath_class_entry, &expr, &expr_len, &context, dom_node_class_entry) == FAILURE) {
+ if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os&|O", &id, dom_xpath_class_entry, &expr, &expr_len, UG(utf8_conv), &context, dom_node_class_entry) == FAILURE) {
return;
}