Skip to content

Commit bf36ac1

Browse files
committed
Use zend_ini_parse_quantity
1 parent b840f14 commit bf36ac1

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

ext/standard/basic_functions.c

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
#include "ext/session/php_session.h"
3131
#include "zend_exceptions.h"
3232
#include "zend_attributes.h"
33+
#include "zend_ini.h"
3334
#include "zend_operators.h"
3435
#include "ext/standard/php_dns.h"
3536
#include "ext/standard/php_uuencode.h"
@@ -1974,14 +1975,19 @@ PHP_FUNCTION(highlight_string)
19741975
/* {{{ Get interpreted size from the ini shorthand syntax */
19751976
PHP_FUNCTION(ini_parse_quantity)
19761977
{
1977-
char *shorthand;
1978-
size_t shorthand_len;
1978+
zend_string *shorthand;
1979+
zend_string *errstr;
19791980

19801981
ZEND_PARSE_PARAMETERS_START(1, 1)
1981-
Z_PARAM_STRING(shorthand, shorthand_len)
1982+
Z_PARAM_STR(shorthand)
19821983
ZEND_PARSE_PARAMETERS_END();
19831984

1984-
RETVAL_LONG(zend_atol(shorthand, shorthand_len));
1985+
RETVAL_LONG(zend_ini_parse_quantity(shorthand, &errstr));
1986+
1987+
if (errstr) {
1988+
zend_error(E_WARNING, "%s", ZSTR_VAL(errstr));
1989+
zend_string_release(errstr);
1990+
}
19851991
}
19861992
/* }}} */
19871993

0 commit comments

Comments
 (0)