Skip to content

Commit cc37919

Browse files
committed
ext/session: use ini quantity parsing API
1 parent c4a7ea1 commit cc37919

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

ext/session/session.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -718,7 +718,7 @@ static PHP_INI_MH(OnUpdateCookieLifetime)
718718
#else
719719
const zend_long maxcookie = ZEND_LONG_MAX / 2 - 1;
720720
#endif
721-
zend_long v = (zend_long)atol(ZSTR_VAL(new_value));
721+
zend_long v = zend_ini_parse_quantity_warn(new_value, entry->name);
722722
if (v < 0) {
723723
php_error_docref(NULL, E_WARNING, "CookieLifetime cannot be negative");
724724
return FAILURE;
@@ -834,12 +834,12 @@ static PHP_INI_MH(OnUpdateSessionDivisor)
834834

835835
static PHP_INI_MH(OnUpdateRfc1867Freq)
836836
{
837-
int tmp = ZEND_ATOL(ZSTR_VAL(new_value));
838-
if(tmp < 0) {
837+
zend_long tmp = zend_ini_parse_quantity_warn(new_value, entry->name);
838+
if (tmp < 0) {
839839
php_error_docref(NULL, E_WARNING, "session.upload_progress.freq must be greater than or equal to 0");
840840
return FAILURE;
841841
}
842-
if(ZSTR_LEN(new_value) > 0 && ZSTR_VAL(new_value)[ZSTR_LEN(new_value)-1] == '%') {
842+
if (ZSTR_LEN(new_value) > 0 && ZSTR_VAL(new_value)[ZSTR_LEN(new_value)-1] == '%') {
843843
if(tmp > 100) {
844844
php_error_docref(NULL, E_WARNING, "session.upload_progress.freq must be less than or equal to 100%%");
845845
return FAILURE;

0 commit comments

Comments
 (0)