cvs: php-src(PHP_5_2) / NEWS /main/streams userspace.c
| From: | Antony Dovgal | Date: | Mon, 14 Aug 2006 15:01:29 +0000 |
| Subject: | cvs: php-src(PHP_5_2) / NEWS /main/streams userspace.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-39966@lists.php.net to get a copy of this message | ||
tony2001 Mon Aug 14 15:01:29 2006 UTC
Modified files: (Branch: PHP_5_2)
/php-src NEWS
/php-src/main/streams userspace.c
Log:
MFH: fix #38450 (constructor is not called for classes used in userspace stream wrappers)
http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.199&r2=1.2027.2.547.2.200&diff_format=u
Index: php-src/NEWS
diff -u php-src/NEWS:1.2027.2.547.2.199 php-src/NEWS:1.2027.2.547.2.200
--- php-src/NEWS:1.2027.2.547.2.199 Mon Aug 14 11:59:24 2006
+++ php-src/NEWS Mon Aug 14 15:01:29 2006
@@ -37,6 +37,8 @@
- Fixed phpinfo() cutoff of variables at \0. (Ilia)
- Fixed a bug in the filter extension that prevented magic_quotes_gpc from
being applied when RAW filter is used. (Ilia)
+- Fixed bug #38450 (constructor is not called for classes used in userspace
+ stream wrappers). (Tony)
- Fixed bug #38438 (DOMNodeList->item(0) segfault on empty NodeList). (Ilia)
- Fixed bug #38431 (xmlrpc_get_type() crashes PHP on objects). (Tony)
- Fixed bug #38424 (Different attribute assignment if new or existing). (Rob)
http://cvs.php.net/viewvc.cgi/php-src/main/streams/userspace.c?r1=1.31.2.3&r2=1.31.2.3.2.1&diff_format=u
Index: php-src/main/streams/userspace.c
diff -u php-src/main/streams/userspace.c:1.31.2.3 php-src/main/streams/userspace.c:1.31.2.3.2.1
--- php-src/main/streams/userspace.c:1.31.2.3 Sat Apr 22 17:17:40 2006
+++ php-src/main/streams/userspace.c Mon Aug 14 15:01:29 2006
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: userspace.c,v 1.31.2.3 2006/04/22 17:17:40 wez Exp $ */
+/* $Id: userspace.c,v 1.31.2.3.2.1 2006/08/14 15:01:29 tony2001 Exp $ */
#include "php.h"
#include "php_globals.h"
@@ -231,6 +231,40 @@
object_init_ex(us->object, uwrap->ce);
ZVAL_REFCOUNT(us->object) = 1;
PZVAL_IS_REF(us->object) = 1;
+
+ if (uwrap->ce->constructor) {
+ zend_fcall_info fci;
+ zend_fcall_info_cache fcc;
+ zval *retval_ptr;
+
+ fci.size = sizeof(fci);
+ fci.function_table = &uwrap->ce->function_table;
+ fci.function_name = NULL;
+ fci.symbol_table = NULL;
+ fci.object_pp = &us->object;
+ fci.retval_ptr_ptr = &retval_ptr;
+ fci.param_count = 0;
+ fci.params = NULL;
+ fci.no_separation = 1;
+
+ fcc.initialized = 1;
+ fcc.function_handler = uwrap->ce->constructor;
+ fcc.calling_scope = EG(scope);
+ fcc.object_pp = &us->object;
+
+ if (zend_call_function(&fci, &fcc TSRMLS_CC) == FAILURE) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Could not execute %s::%s()",
uwrap->ce->name, uwrap->ce->constructor->common.function_name);
+ zval_dtor(us->object);
+ FREE_ZVAL(us->object);
+ efree(us);
+ FG(user_stream_current_filename) = NULL;
+ return NULL;
+ } else {
+ if (retval_ptr) {
+ zval_ptr_dtor(&retval_ptr);
+ }
+ }
+ }
if (context) {
MAKE_STD_ZVAL(zcontext);