Skip to content

Commit 72ec2e8

Browse files
author
Thies C. Arntzen
committed
fixed SEGFAULT when using xml_set_object. Zend does not yes support
cyclic references!
1 parent cd55dfa commit 72ec2e8

File tree

1 file changed

+10
-17
lines changed

1 file changed

+10
-17
lines changed

ext/xml/xml.c

Lines changed: 10 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -294,9 +294,11 @@ xml_parser_dtor(zend_rsrc_list_entry *rsrc)
294294
{
295295
xml_parser *parser = (xml_parser *)rsrc->ptr;
296296

297-
if (parser->object) {
297+
/* please leave this commented - or ask thies@thieso.net before doing it (again)
298+
if (parser->object) {
298299
zval_del_ref(&parser->object);
299300
}
301+
*/
300302

301303
if (parser->parser) {
302304
XML_ParserFree(parser->parser);
@@ -1175,19 +1177,19 @@ PHP_FUNCTION(xml_set_object)
11751177
RETURN_FALSE;
11761178
}
11771179

1178-
if (! ParameterPassedByReference(ht,2)) {
1179-
php_error(E_WARNING,"arg 2 not passed by reference");
1180-
RETURN_FALSE;
1181-
}
1182-
11831180
ZEND_FETCH_RESOURCE(parser,xml_parser *,pind, -1, "XML Parser", le_xml_parser);
11841181

1185-
if (parser->object) {
1182+
/* please leave this commented - or ask thies@thieso.net before doing it (again)
1183+
if (parser->object) {
11861184
zval_del_ref(&parser->object);
11871185
}
1186+
*/
11881187

11891188
parser->object = *mythis;
1190-
zval_add_ref(&parser->object);
1189+
1190+
/* please leave this commented - or ask thies@thieso.net before doing it (again)
1191+
zval_add_ref(&parser->object);
1192+
*/
11911193

11921194
RETVAL_TRUE;
11931195
}
@@ -1405,21 +1407,12 @@ PHP_FUNCTION(xml_parse_into_struct)
14051407

14061408
argc = ZEND_NUM_ARGS();
14071409
if (zend_get_parameters_ex(4, &pind, &data, &xdata,&info) == SUCCESS) {
1408-
if (!ParameterPassedByReference(ht, 4)) {
1409-
php_error(E_WARNING, "Array to be filled with values must be passed by reference.");
1410-
RETURN_FALSE;
1411-
}
14121410
zval_dtor(*info);
14131411
array_init(*info);
14141412
} else if (zend_get_parameters_ex(3, &pind, &data, &xdata) == FAILURE) {
14151413
WRONG_PARAM_COUNT;
14161414
}
14171415

1418-
if (!ParameterPassedByReference(ht, 3)) {
1419-
php_error(E_WARNING, "Array to be filled with values must be passed by reference.");
1420-
RETURN_FALSE;
1421-
}
1422-
14231416
ZEND_FETCH_RESOURCE(parser,xml_parser *, pind, -1, "XML Parser", le_xml_parser);
14241417

14251418
convert_to_string_ex(data);

0 commit comments

Comments
 (0)