cvs: php-src(PHP_5_2) /ext/spl php_spl.c /main main.c php_main.h
| From: | Ilia Alshanetsky | Date: | Mon, 08 Jan 2007 03:39:09 +0000 |
| Subject: | cvs: php-src(PHP_5_2) /ext/spl php_spl.c /main main.c php_main.h | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-42607@lists.php.net to get a copy of this message | ||
iliaa Mon Jan 8 03:39:09 2007 UTC
Modified files: (Branch: PHP_5_2)
/php-src/main main.c php_main.h
/php-src/ext/spl php_spl.c
Log:
Provide means for opening file for zend with error supression. Allows us to
avoid INI hackery such as the one used in SPL.
http://cvs.php.net/viewvc.cgi/php-src/main/main.c?r1=1.640.2.23.2.28&r2=1.640.2.23.2.29&diff_format=u
Index: php-src/main/main.c
diff -u php-src/main/main.c:1.640.2.23.2.28 php-src/main/main.c:1.640.2.23.2.29
--- php-src/main/main.c:1.640.2.23.2.28 Mon Jan 1 09:36:11 2007
+++ php-src/main/main.c Mon Jan 8 03:39:09 2007
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: main.c,v 1.640.2.23.2.28 2007/01/01 09:36:11 sebastian Exp $ */
+/* $Id: main.c,v 1.640.2.23.2.29 2007/01/08 03:39:09 iliaa Exp $ */
/* {{{ includes
*/
@@ -904,9 +904,14 @@
static int php_stream_open_for_zend(const char *filename, zend_file_handle *handle TSRMLS_DC)
{
+ return php_stream_open_for_zend_ex(filename, handle,
ENFORCE_SAFE_MODE|USE_PATH|REPORT_ERRORS|STREAM_OPEN_FOR_INCLUDE TSRMLS_CC);
+}
+
+PHPAPI int php_stream_open_for_zend_ex(const char *filename, zend_file_handle *handle, int mode
TSRMLS_DC)
+{
php_stream *stream;
- stream = php_stream_open_wrapper((char *)filename, "rb",
ENFORCE_SAFE_MODE|USE_PATH|REPORT_ERRORS|STREAM_OPEN_FOR_INCLUDE, &handle->opened_path);
+ stream = php_stream_open_wrapper((char *)filename, "rb", mode,
&handle->opened_path);
if (stream) {
handle->type = ZEND_HANDLE_STREAM;
@@ -925,7 +930,6 @@
return FAILURE;
}
-
/* {{{ php_get_configuration_directive_for_zend
*/
static int php_get_configuration_directive_for_zend(char *name, uint name_length, zval *contents)
http://cvs.php.net/viewvc.cgi/php-src/main/php_main.h?r1=1.34.2.1.2.1&r2=1.34.2.1.2.2&diff_format=u
Index: php-src/main/php_main.h
diff -u php-src/main/php_main.h:1.34.2.1.2.1 php-src/main/php_main.h:1.34.2.1.2.2
--- php-src/main/php_main.h:1.34.2.1.2.1 Mon Jan 1 09:36:11 2007
+++ php-src/main/php_main.h Mon Jan 8 03:39:09 2007
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_main.h,v 1.34.2.1.2.1 2007/01/01 09:36:11 sebastian Exp $ */
+/* $Id: php_main.h,v 1.34.2.1.2.2 2007/01/08 03:39:09 iliaa Exp $ */
#ifndef PHP_MAIN_H
#define PHP_MAIN_H
@@ -47,6 +47,7 @@
PHPAPI int php_handle_auth_data(const char *auth TSRMLS_DC);
PHPAPI void php_html_puts(const char *str, uint siz TSRMLS_DC);
+PHPAPI int php_stream_open_for_zend_ex(const char *filename, zend_file_handle *handle, int mode
TSRMLS_DC);
extern void php_call_shutdown_functions(TSRMLS_D);
extern void php_free_shutdown_functions(TSRMLS_D);
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/php_spl.c?r1=1.52.2.28.2.11&r2=1.52.2.28.2.12&diff_format=u
Index: php-src/ext/spl/php_spl.c
diff -u php-src/ext/spl/php_spl.c:1.52.2.28.2.11 php-src/ext/spl/php_spl.c:1.52.2.28.2.12
--- php-src/ext/spl/php_spl.c:1.52.2.28.2.11 Mon Jan 1 09:36:07 2007
+++ php-src/ext/spl/php_spl.c Mon Jan 8 03:39:09 2007
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_spl.c,v 1.52.2.28.2.11 2007/01/01 09:36:07 sebastian Exp $ */
+/* $Id: php_spl.c,v 1.52.2.28.2.12 2007/01/08 03:39:09 iliaa Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -24,6 +24,7 @@
#include "php.h"
#include "php_ini.h"
+#include "php_main.h"
#include "ext/standard/info.h"
#include "php_spl.h"
#include "spl_functions.h"
@@ -207,7 +208,7 @@
}
/* }}} */
-int spl_autoload(const char *class_name, const char * lc_name, int class_name_len, const char *
file_extension TSRMLS_DC) /* {{{ */
+static int spl_autoload(const char *class_name, const char * lc_name, int class_name_len, const
char * file_extension TSRMLS_DC) /* {{{ */
{
char *class_file;
int class_file_len;
@@ -215,23 +216,11 @@
zend_file_handle file_handle;
zend_op_array *new_op_array;
zval *result = NULL;
- zval err_mode;
int ret;
class_file_len = spprintf(&class_file, 0, "%s%s", lc_name, file_extension);
- ZVAL_LONG(&err_mode, EG(error_reporting));
- if (Z_LVAL(err_mode)) {
- php_alter_ini_entry("error_reporting", sizeof("error_reporting"),
"0", 1, ZEND_INI_USER, ZEND_INI_STAGE_RUNTIME);
- }
-
- ret = zend_stream_open(class_file, &file_handle TSRMLS_CC);
-
- if (!EG(error_reporting) && Z_LVAL(err_mode) != EG(error_reporting)) {
- convert_to_string(&err_mode);
- zend_alter_ini_entry("error_reporting", sizeof("error_reporting"),
Z_STRVAL(err_mode), Z_STRLEN(err_mode), ZEND_INI_USER, ZEND_INI_STAGE_RUNTIME);
- zendi_zval_dtor(err_mode);
- }
+ ret = php_stream_open_for_zend_ex(class_file, &file_handle,
ENFORCE_SAFE_MODE|USE_PATH|STREAM_OPEN_FOR_INCLUDE TSRMLS_CC);
if (ret == SUCCESS) {
if (!file_handle.opened_path) {