mirror of
https://github.com/php/php-src.git
synced 2025-08-19 08:49:28 +02:00
- Add ability to add new nodes via properties
This commit is contained in:
parent
4ad7d57a97
commit
b13105ee4c
1 changed files with 5 additions and 0 deletions
|
@ -390,6 +390,7 @@ static void sxe_prop_dim_write(zval *object, zval *member, zval *value, zend_boo
|
||||||
char *name;
|
char *name;
|
||||||
xmlNodePtr node;
|
xmlNodePtr node;
|
||||||
xmlNodePtr newnode = NULL;
|
xmlNodePtr newnode = NULL;
|
||||||
|
xmlNodePtr mynode;
|
||||||
xmlNodePtr tempnode;
|
xmlNodePtr tempnode;
|
||||||
xmlAttrPtr attr = NULL;
|
xmlAttrPtr attr = NULL;
|
||||||
int counter = 0;
|
int counter = 0;
|
||||||
|
@ -450,6 +451,8 @@ static void sxe_prop_dim_write(zval *object, zval *member, zval *value, zend_boo
|
||||||
test = 0;
|
test = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mynode = node;
|
||||||
|
|
||||||
if (node) {
|
if (node) {
|
||||||
if (attribs) {
|
if (attribs) {
|
||||||
if (Z_TYPE_P(member) == IS_LONG) {
|
if (Z_TYPE_P(member) == IS_LONG) {
|
||||||
|
@ -510,6 +513,8 @@ next_iter:
|
||||||
change_node_zval(newnode, value TSRMLS_CC);
|
change_node_zval(newnode, value TSRMLS_CC);
|
||||||
} else if (counter > 1) {
|
} else if (counter > 1) {
|
||||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot assign to an array of nodes (duplicate subnodes or attr detected)");
|
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot assign to an array of nodes (duplicate subnodes or attr detected)");
|
||||||
|
} else if (elements && !node) {
|
||||||
|
xmlNewChild(mynode, mynode->ns, name, Z_STRVAL_P(value));
|
||||||
} else {
|
} else {
|
||||||
if (attribs) {
|
if (attribs) {
|
||||||
switch (Z_TYPE_P(value)) {
|
switch (Z_TYPE_P(value)) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue