Skip to content

Commit c74573f

Browse files
committed
Clean up ext/session errors
1 parent e9b47df commit c74573f

File tree

51 files changed

+284
-280
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+284
-280
lines changed

ext/session/mod_files.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,12 +168,12 @@ static void ps_files_open(ps_files *data, const char *key)
168168
ps_files_close(data);
169169

170170
if (php_session_valid_key(key) == FAILURE) {
171-
php_error_docref(NULL, E_WARNING, "The session id is too long or contains illegal characters, valid characters are a-z, A-Z, 0-9 and '-,'");
171+
php_error_docref(NULL, E_WARNING, "Session ID is too long or contains illegal characters. Valid characters are a-z, A-Z, 0-9, and \"-\"");
172172
return;
173173
}
174174

175175
if (!ps_files_path_create(buf, sizeof(buf), data, key)) {
176-
php_error_docref(NULL, E_WARNING, "Failed to create session data file path. Too short session ID, invalid save_path or path lentgth exceeds MAXPATHLEN(%d)", MAXPATHLEN);
176+
php_error_docref(NULL, E_WARNING, "Failed to create session data file path. Too short session ID, invalid save_path or path length exceeds %d characters", MAXPATHLEN);
177177
return;
178178
}
179179

ext/session/mod_user.c

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -58,15 +58,18 @@ static void ps_call_handler(zval *func, int argc, zval *argv, zval *retval)
5858
} else if (Z_TYPE(retval) == IS_FALSE) { \
5959
ret = FAILURE; \
6060
} else if ((Z_TYPE(retval) == IS_LONG) && (Z_LVAL(retval) == -1)) { \
61-
/* BC for clever users - Deprecate me */ \
61+
if (!EG(exception)) { \
62+
php_error_docref(NULL, E_DEPRECATED, "Session callback must have a return value of type bool, %s returned", zend_zval_type_name(&retval)); \
63+
} \
6264
ret = FAILURE; \
6365
} else if ((Z_TYPE(retval) == IS_LONG) && (Z_LVAL(retval) == 0)) { \
64-
/* BC for clever users - Deprecate me */ \
66+
if (!EG(exception)) { \
67+
php_error_docref(NULL, E_DEPRECATED, "Session callback must have a return value of type bool, %s returned", zend_zval_type_name(&retval)); \
68+
} \
6569
ret = SUCCESS; \
6670
} else { \
6771
if (!EG(exception)) { \
68-
php_error_docref(NULL, E_WARNING, \
69-
"Session callback expects true/false return value"); \
72+
php_error_docref(NULL, E_WARNING, "Session callback must have a return value of type bool, %s returned", zend_zval_type_name(&retval)); \
7073
} \
7174
ret = FAILURE; \
7275
zval_ptr_dtor(&retval); \
@@ -80,8 +83,7 @@ PS_OPEN_FUNC(user)
8083
STDVARS;
8184

8285
if (Z_ISUNDEF(PSF(open))) {
83-
php_error_docref(NULL, E_WARNING,
84-
"user session functions not defined");
86+
php_error_docref(NULL, E_WARNING, "User session functions are not defined");
8587

8688
return FAILURE;
8789
}

ext/session/php_session.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ PHPAPI int php_session_reset_id(void);
291291
HashTable *_ht = Z_ARRVAL_P(Z_REFVAL(PS(http_session_vars))); \
292292
ZEND_HASH_FOREACH_KEY(_ht, num_key, key) { \
293293
if (key == NULL) { \
294-
php_error_docref(NULL, E_NOTICE, \
294+
php_error_docref(NULL, E_WARNING, \
295295
"Skipping numeric key " ZEND_LONG_FMT, num_key);\
296296
continue; \
297297
} \

0 commit comments

Comments
 (0)