From dcfe98882096ac3dd4c1291870f545bd4c21cdf2 Mon Sep 17 00:00:00 2001 From: Marcus Boerger Date: Thu, 5 Dec 2002 20:13:35 +0000 Subject: [PATCH] php_error -> php_error_docref --- ext/session/mod_files.c | 16 ++++++++-------- ext/session/mod_mm.c | 6 ++++-- ext/session/session.c | 36 ++++++++++++++++++------------------ 3 files changed, 30 insertions(+), 28 deletions(-) diff --git a/ext/session/mod_files.c b/ext/session/mod_files.c index 541adbea91..07baf5f91e 100644 --- a/ext/session/mod_files.c +++ b/ext/session/mod_files.c @@ -142,7 +142,7 @@ static void ps_files_open(ps_files *data, const char *key TSRMLS_DC) ps_files_close(data); if (!ps_files_valid_key(key)) { - php_error(E_WARNING, "The session id contains illegal characters, valid characters are only a-z, A-Z and 0-9"); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "The session id contains illegal characters, valid characters are only a-z, A-Z and 0-9"); return; } if (!ps_files_path_create(buf, sizeof(buf), data, key)) @@ -157,11 +157,11 @@ static void ps_files_open(ps_files *data, const char *key TSRMLS_DC) #ifdef F_SETFD if (fcntl(data->fd, F_SETFD, 1)) { - php_error(E_WARNING, "fcntl(%d, F_SETFD, 1) failed: %s (%d)", data->fd, strerror(errno), errno); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "fcntl(%d, F_SETFD, 1) failed: %s (%d)", data->fd, strerror(errno), errno); } #endif } else { - php_error(E_WARNING, "open(%s, O_RDWR) failed: %s (%d)", buf, + php_error_docref(NULL TSRMLS_CC, E_WARNING, "open(%s, O_RDWR) failed: %s (%d)", buf, strerror(errno), errno); } } @@ -180,7 +180,7 @@ static int ps_files_cleanup_dir(const char *dirname, int maxlifetime TSRMLS_DC) dir = opendir(dirname); if (!dir) { - php_error(E_NOTICE, "ps_files_cleanup_dir: opendir(%s) failed: %s (%d)\n", dirname, strerror(errno), errno); + php_error_docref(NULL TSRMLS_CC, E_NOTICE, "ps_files_cleanup_dir: opendir(%s) failed: %s (%d)\n", dirname, strerror(errno), errno); return (0); } @@ -280,9 +280,9 @@ PS_READ_FUNC(files) if (n != sbuf.st_size) { if (n == -1) - php_error(E_WARNING, "read failed: %s (%d)", strerror(errno), errno); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "read failed: %s (%d)", strerror(errno), errno); else - php_error(E_WARNING, "read returned less bytes than requested"); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "read returned less bytes than requested"); efree(*val); return FAILURE; } @@ -316,9 +316,9 @@ PS_WRITE_FUNC(files) if (n != vallen) { if (n == -1) - php_error(E_WARNING, "write failed: %s (%d)", strerror(errno), errno); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "write failed: %s (%d)", strerror(errno), errno); else - php_error(E_WARNING, "write wrote less bytes than requested"); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "write wrote less bytes than requested"); return FAILURE; } diff --git a/ext/session/mod_mm.c b/ext/session/mod_mm.c index a555e5d2e0..0853a6b7a8 100644 --- a/ext/session/mod_mm.c +++ b/ext/session/mod_mm.c @@ -124,7 +124,9 @@ static ps_sd *ps_sd_new(ps_mm *data, const char *key) sd = mm_malloc(data->mm, sizeof(ps_sd) + keylen); if (!sd) { - php_error(E_WARNING, "mm_malloc failed, avail %d, err %s", mm_available(data->mm), mm_error()); + TSRMlS_FETCH(); + + php_error_docref(NULL TSRMLS_CC, E_WARNING, "mm_malloc failed, avail %d, err %s", mm_available(data->mm), mm_error()); return NULL; } @@ -359,7 +361,7 @@ PS_WRITE_FUNC(mm) if (!sd->data) { ps_sd_destroy(data, sd); - php_error(E_WARNING, "cannot allocate new data segment"); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "cannot allocate new data segment"); sd = NULL; } } diff --git a/ext/session/session.c b/ext/session/session.c index dc3b9c8e5c..29bc9466c2 100644 --- a/ext/session/session.c +++ b/ext/session/session.c @@ -86,7 +86,7 @@ static const ps_serializer *_php_find_ps_serializer(char *name TSRMLS_DC); static PHP_INI_MH(OnUpdateSaveHandler) { if (PS(session_status) == php_session_active) { - php_error(E_WARNING, "A session is active. You cannot change the session module's ini settings at this time."); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "A session is active. You cannot change the session module's ini settings at this time."); return FAILURE; } PS(mod) = _php_find_ps_module(new_value TSRMLS_CC); @@ -98,7 +98,7 @@ static PHP_INI_MH(OnUpdateSaveHandler) #if 0 if(!PS(mod)) { - php_error(E_ERROR,"Cannot find save handler %s",new_value); + php_error_docref(E_ERROR, "Cannot find save handler %s", new_value); } #endif return SUCCESS; @@ -107,7 +107,7 @@ static PHP_INI_MH(OnUpdateSaveHandler) static PHP_INI_MH(OnUpdateSerializer) { if (PS(session_status) == php_session_active) { - php_error(E_WARNING, "A session is active. You cannot change the session module's ini settings at this time."); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "A session is active. You cannot change the session module's ini settings at this time."); return FAILURE; } PS(serializer) = _php_find_ps_serializer(new_value TSRMLS_CC); @@ -119,7 +119,7 @@ static PHP_INI_MH(OnUpdateSerializer) #if 0 if(!PS(serializer)) { - php_error(E_ERROR,"Cannot find serialization handler %s",new_value); + php_error_docref(E_ERROR, "Cannot find serialization handler %s", new_value); } #endif return SUCCESS; @@ -531,7 +531,7 @@ static void php_session_decode(const char *val, int vallen TSRMLS_DC) { if (PS(serializer)->decode(val, vallen TSRMLS_CC) == FAILURE) { php_session_destroy(TSRMLS_C); - php_error(E_WARNING, "Failed to decode session object. Session has been destroyed."); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Failed to decode session object. Session has been destroyed."); } } @@ -598,7 +598,7 @@ static void php_session_initialize(TSRMLS_D) /* Open session handler first */ if (PS(mod)->open(&PS(mod_data), PS(save_path), PS(session_name) TSRMLS_CC) == FAILURE) { - php_error(E_ERROR, "Failed to initialize session module"); + php_error_docref(NULL TSRMLS_CC, E_ERROR, "Failed to initialize session module"); return; } @@ -639,7 +639,7 @@ static int migrate_global(HashTable *ht, HashPosition *pos TSRMLS_DC) } break; case HASH_KEY_IS_LONG: - php_error(E_NOTICE, "The session bug compatibility code will not " + php_error_docref(NULL TSRMLS_CC, E_NOTICE, "The session bug compatibility code will not " "try to locate the global variable $%d due to its " "numeric nature.", num_key); break; @@ -671,7 +671,7 @@ static void php_session_save_current_state(TSRMLS_D) } if (do_warn && PS(bug_compat_warn)) { - php_error(E_WARNING, "Your script possibly relies on a session side-effect which existed until PHP 4.2.3. Please be advised that the session extension does not consider global variables as a source of data, unless register_globals is enabled. You can disable this functionality and this warning by setting session.bug_compat_42 or session.bug_compat_warn to off, respectively."); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Your script possibly relies on a session side-effect which existed until PHP 4.2.3. Please be advised that the session extension does not consider global variables as a source of data, unless register_globals is enabled. You can disable this functionality and this warning by setting session.bug_compat_42 or session.bug_compat_warn to off, respectively."); } } @@ -689,7 +689,7 @@ static void php_session_save_current_state(TSRMLS_D) } if (ret == FAILURE) - php_error(E_WARNING, "Failed to write session data (%s). Please " + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Failed to write session data (%s). Please " "verify that the current setting of session.save_path " "is correct (%s)", PS(mod)->name, @@ -808,10 +808,10 @@ static int php_session_cache_limiter(TSRMLS_D) int output_start_lineno = php_get_output_start_lineno(TSRMLS_C); if (output_start_filename) { - php_error(E_WARNING, "Cannot send session cache limiter - headers already sent (output started at %s:%d)", + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot send session cache limiter - headers already sent (output started at %s:%d)", output_start_filename, output_start_lineno); } else { - php_error(E_WARNING, "Cannot send session cache limiter - headers already sent"); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot send session cache limiter - headers already sent"); } return -2; } @@ -842,10 +842,10 @@ static void php_session_send_cookie(TSRMLS_D) int output_start_lineno = php_get_output_start_lineno(TSRMLS_C); if (output_start_filename) { - php_error(E_WARNING, "Cannot send session cookie - headers already sent by (output started at %s:%d)", + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot send session cookie - headers already sent by (output started at %s:%d)", output_start_filename, output_start_lineno); } else { - php_error(E_WARNING, "Cannot send session cookie - headers already sent"); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot send session cookie - headers already sent"); } return; } @@ -1051,7 +1051,7 @@ PHPAPI void php_session_start(TSRMLS_D) PS(mod)->gc(&PS(mod_data), PS(gc_maxlifetime), &nrdels TSRMLS_CC); #if 0 if (nrdels != -1) - php_error(E_NOTICE, "purged %d expired session objects\n", nrdels); + php_error_docref(NULL TSRMLS_CC, E_NOTICE, "purged %d expired session objects\n", nrdels); #endif } } @@ -1062,13 +1062,13 @@ static zend_bool php_session_destroy(TSRMLS_D) zend_bool retval = SUCCESS; if (PS(session_status) != php_session_active) { - php_error(E_WARNING, "Trying to destroy uninitialized session"); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Trying to destroy uninitialized session"); return FAILURE; } if (PS(mod)->destroy(&PS(mod_data), PS(id) TSRMLS_CC) == FAILURE) { retval = FAILURE; - php_error(E_WARNING, "Session object destruction failed"); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Session object destruction failed"); } php_rshutdown_session_globals(TSRMLS_C); @@ -1119,7 +1119,7 @@ PHP_FUNCTION(session_get_cookie_params) } if (array_init(return_value) == FAILURE) { - php_error(E_ERROR, "Cannot initialize return value from session_get_cookie_parameters"); + php_error_docref(NULL TSRMLS_CC, E_ERROR, "Cannot initialize return value from session_get_cookie_parameters"); RETURN_FALSE; } @@ -1177,7 +1177,7 @@ PHP_FUNCTION(session_module_name) PS(mod_data) = NULL; } else { efree(old); - php_error(E_ERROR, "Cannot find named PHP session module (%s)", + php_error_docref(NULL TSRMLS_CC, E_ERROR, "Cannot find named PHP session module (%s)", Z_STRVAL_PP(p_name)); RETURN_FALSE; } -- 2.40.0