Skip to content

Clean up ext/session errors #6111

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions ext/session/mod_files.c
Original file line number Diff line number Diff line change
Expand Up @@ -168,12 +168,12 @@ static void ps_files_open(ps_files *data, const char *key)
ps_files_close(data);

if (php_session_valid_key(key) == FAILURE) {
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 '-,'");
php_error_docref(NULL, E_WARNING, "Session ID is too long or contains illegal characters. Only the A-Z, a-z, 0-9, \"-\", and \",\" characters are allowed");
return;
}

if (!ps_files_path_create(buf, sizeof(buf), data, key)) {
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);
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);
return;
}

Expand Down
14 changes: 8 additions & 6 deletions ext/session/mod_user.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,15 +58,18 @@ static void ps_call_handler(zval *func, int argc, zval *argv, zval *retval)
} else if (Z_TYPE(retval) == IS_FALSE) { \
ret = FAILURE; \
} else if ((Z_TYPE(retval) == IS_LONG) && (Z_LVAL(retval) == -1)) { \
/* BC for clever users - Deprecate me */ \
if (!EG(exception)) { \
php_error_docref(NULL, E_DEPRECATED, "Session callback must have a return value of type bool, %s returned", zend_zval_type_name(&retval)); \
} \
ret = FAILURE; \
} else if ((Z_TYPE(retval) == IS_LONG) && (Z_LVAL(retval) == 0)) { \
/* BC for clever users - Deprecate me */ \
if (!EG(exception)) { \
php_error_docref(NULL, E_DEPRECATED, "Session callback must have a return value of type bool, %s returned", zend_zval_type_name(&retval)); \
} \
ret = SUCCESS; \
} else { \
if (!EG(exception)) { \
php_error_docref(NULL, E_WARNING, \
"Session callback expects true/false return value"); \
zend_type_error("Session callback must have a return value of type bool, %s returned", zend_zval_type_name(&retval)); \
} \
ret = FAILURE; \
zval_ptr_dtor(&retval); \
Expand All @@ -80,8 +83,7 @@ PS_OPEN_FUNC(user)
STDVARS;

if (Z_ISUNDEF(PSF(open))) {
php_error_docref(NULL, E_WARNING,
"user session functions not defined");
php_error_docref(NULL, E_WARNING, "User session functions are not defined");

return FAILURE;
}
Expand Down
2 changes: 1 addition & 1 deletion ext/session/php_session.h
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ PHPAPI int php_session_reset_id(void);
HashTable *_ht = Z_ARRVAL_P(Z_REFVAL(PS(http_session_vars))); \
ZEND_HASH_FOREACH_KEY(_ht, num_key, key) { \
if (key == NULL) { \
php_error_docref(NULL, E_NOTICE, \
php_error_docref(NULL, E_WARNING, \
"Skipping numeric key " ZEND_LONG_FMT, num_key);\
continue; \
} \
Expand Down
Loading