helly Tue May 23 21:58:45 2006 UTC
Added files: (Branch: PHP_5_2)
/php-src/ext/simplexml/tests bug37565.phpt
Modified files:
/php-src NEWS
/php-src/ext/simplexml simplexml.c
Log:
- MFH Bugfix #37565
http://cvs.php.net/viewcvs.cgi/php-src/NEWS?r1=1.2027.2.547.2.39&r2=1.2027.2.547.2.40&diff_format=u
Index: php-src/NEWS
diff -u php-src/NEWS:1.2027.2.547.2.39 php-src/NEWS:1.2027.2.547.2.40
--- php-src/NEWS:1.2027.2.547.2.39 Mon May 22 19:04:19 2006
+++ php-src/NEWS Tue May 23 21:58:44 2006
@@ -43,6 +43,8 @@
- Added pg_field_table() function. (Edin)
- Added implementation of curl_multi_info_read(). (Brian)
- Added RFC2397 (data: stream) support. (Marcus)
+- Fixed bug #37565 (Using reflection::export with simplexml causing a crash).
+ (Marcus)
- Fixed bug #37514 (strtotime doesn't assume year correctly). (Derick)
- Fixed bug #37510 (session_regenerate_id changes session_id() even on
failure). (Hannes)
http://cvs.php.net/viewcvs.cgi/php-src/ext/simplexml/simplexml.c?r1=1.151.2.22.2.3&r2=1.151.2.22.2.4&diff_format=u
Index: php-src/ext/simplexml/simplexml.c
diff -u php-src/ext/simplexml/simplexml.c:1.151.2.22.2.3
php-src/ext/simplexml/simplexml.c:1.151.2.22.2.4
--- php-src/ext/simplexml/simplexml.c:1.151.2.22.2.3 Wed May 17 00:07:28 2006
+++ php-src/ext/simplexml/simplexml.c Tue May 23 21:58:44 2006
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: simplexml.c,v 1.151.2.22.2.3 2006/05/17 00:07:28 helly Exp $ */
+/* $Id: simplexml.c,v 1.151.2.22.2.4 2006/05/23 21:58:44 helly Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -1837,12 +1837,10 @@
char *filename;
int filename_len;
xmlDocPtr docp;
- char *classname = "";
- int classname_len = 0;
long options = 0;
zend_class_entry *ce= sxe_class_entry;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|sl", &filename,
&filename_len, &classname, &classname_len, &options) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|Cl", &filename,
&filename_len, &ce, &options) == FAILURE) {
return;
}
@@ -1852,14 +1850,6 @@
RETURN_FALSE;
}
- if (classname_len) {
- zend_class_entry **pce;
- if (zend_lookup_class(classname, classname_len, &pce TSRMLS_CC)
== FAILURE) {
- php_error_docref(NULL TSRMLS_CC, E_ERROR, "Class %s
does not exist", classname);
- }
- ce = *pce;
- }
-
sxe = php_sxe_object_new(ce TSRMLS_CC);
php_libxml_increment_doc_ref((php_libxml_node_object *)sxe, docp
TSRMLS_CC);
php_libxml_increment_node_ptr((php_libxml_node_object *)sxe,
xmlDocGetRootElement(docp), NULL TSRMLS_CC);
@@ -1877,12 +1867,10 @@
char *data;
int data_len;
xmlDocPtr docp;
- char *classname = "";
- int classname_len = 0;
long options = 0;
zend_class_entry *ce= sxe_class_entry;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|sl", &data,
&data_len, &classname, &classname_len, &options) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|Cl", &data,
&data_len, &ce, &options) == FAILURE) {
return;
}
@@ -1892,14 +1880,6 @@
RETURN_FALSE;
}
- if (classname_len) {
- zend_class_entry **pce;
- if (zend_lookup_class(classname, classname_len, &pce TSRMLS_CC)
== FAILURE) {
- php_error_docref(NULL TSRMLS_CC, E_ERROR, "Class %s
does not exist", classname);
- }
- ce = *pce;
- }
-
sxe = php_sxe_object_new(ce TSRMLS_CC);
php_libxml_increment_doc_ref((php_libxml_node_object *)sxe, docp
TSRMLS_CC);
php_libxml_increment_node_ptr((php_libxml_node_object *)sxe,
xmlDocGetRootElement(docp), NULL TSRMLS_CC);
@@ -2131,11 +2111,9 @@
zval *node;
php_libxml_node_object *object;
xmlNodePtr nodep = NULL;
- char *classname = "";
- int classname_len = 0;
zend_class_entry *ce= sxe_class_entry;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "o|s", &node,
&classname, &classname_len) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "o|C", &node, &ce)
== FAILURE) {
return;
}
@@ -2154,14 +2132,6 @@
}
if (nodep && nodep->type == XML_ELEMENT_NODE) {
- if (classname_len) {
- zend_class_entry **pce;
- if (zend_lookup_class(classname, classname_len, &pce
TSRMLS_CC) == FAILURE) {
- php_error_docref(NULL TSRMLS_CC, E_ERROR,
"Class %s does not exist", classname);
- }
- ce = *pce;
- }
-
sxe = php_sxe_object_new(ce TSRMLS_CC);
sxe->document = object->document;
php_libxml_increment_doc_ref((php_libxml_node_object *)sxe,
nodep->doc TSRMLS_CC);
@@ -2266,7 +2236,7 @@
{
php_info_print_table_start();
php_info_print_table_header(2, "Simplexml support", "enabled");
- php_info_print_table_row(2, "Revision", "$Revision: 1.151.2.22.2.3 $");
+ php_info_print_table_row(2, "Revision", "$Revision: 1.151.2.22.2.4 $");
php_info_print_table_row(2, "Schema support",
#ifdef LIBXML_SCHEMAS_ENABLED
"enabled");
http://cvs.php.net/viewcvs.cgi/php-src/ext/simplexml/tests/bug37565.phpt?view=markup&rev=1.1
Index: php-src/ext/simplexml/tests/bug37565.phpt
+++ php-src/ext/simplexml/tests/bug37565.phpt
--TEST--
Bug #37565 Using reflection::export with simplexml causing a crash
--FILE--
<?php
class Setting extends ReflectionObject
{
}
Reflection::export(simplexml_load_string('<test/>', 'Setting'));
Reflection::export(simplexml_load_file('data:,<test/>', 'Setting'));
?>
===DONE===
--EXPECTF--
Warning: simplexml_load_string() expects parameter 2 to be a class name derived
from SimpleXMLElement, 'Setting' given in %sbug37565.php on line %d
Warning: Reflection::export() expects parameter 1 to be Reflector, null given
in %sbug37565.php on line %d
Warning: simplexml_load_file() expects parameter 2 to be a class name derived
from SimpleXMLElement, 'Setting' given in %sbug37565.php on line %d
Warning: Reflection::export() expects parameter 1 to be Reflector, null given
in %sbug37565.php on line %d
===DONE===
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php