felipe                                   Sat, 19 Jun 2010 20:47:24 +0000

Revision: http://svn.php.net/viewvc?view=revision&revision=300606

Log:
- Fixed bug #52061 (memory_limit above 2G)
# MFH: zend_atol()

Bug: http://bugs.php.net/52061 (Open) memory_limit above 2G
      
Changed paths:
    U   php/php-src/branches/PHP_5_2/Zend/zend_operators.c
    U   php/php-src/branches/PHP_5_2/Zend/zend_operators.h
    U   php/php-src/branches/PHP_5_2/main/main.c

Modified: php/php-src/branches/PHP_5_2/Zend/zend_operators.c
===================================================================
--- php/php-src/branches/PHP_5_2/Zend/zend_operators.c  2010-06-19 17:01:01 UTC 
(rev 300605)
+++ php/php-src/branches/PHP_5_2/Zend/zend_operators.c  2010-06-19 20:47:24 UTC 
(rev 300606)
@@ -69,7 +69,34 @@
        return retval;
 }

+ZEND_API long zend_atol(const char *str, int str_len) /* {{{ */
+{
+       long retval;

+       if (!str_len) {
+               str_len = strlen(str);
+       }
+       retval = strtol(str, NULL, 0);
+       if (str_len>0) {
+               switch (str[str_len-1]) {
+                       case 'g':
+                       case 'G':
+                               retval *= 1024;
+                               /* break intentionally missing */
+                       case 'm':
+                       case 'M':
+                               retval *= 1024;
+                               /* break intentionally missing */
+                       case 'k':
+                       case 'K':
+                               retval *= 1024;
+                               break;
+               }
+       }
+       return retval;
+}
+/* }}} */
+
 ZEND_API double zend_string_to_double(const char *number, zend_uint length)
 {
        double divisor = 10.0;

Modified: php/php-src/branches/PHP_5_2/Zend/zend_operators.h
===================================================================
--- php/php-src/branches/PHP_5_2/Zend/zend_operators.h  2010-06-19 17:01:01 UTC 
(rev 300605)
+++ php/php-src/branches/PHP_5_2/Zend/zend_operators.h  2010-06-19 20:47:24 UTC 
(rev 300606)
@@ -303,6 +303,7 @@
 ZEND_API void zend_compare_objects(zval *result, zval *o1, zval *o2 TSRMLS_DC);

 ZEND_API int zend_atoi(const char *str, int str_len);
+ZEND_API long zend_atol(const char *str, int str_len);

 ZEND_API void zend_locale_sprintf_double(zval *op ZEND_FILE_LINE_DC);
 END_EXTERN_C()

Modified: php/php-src/branches/PHP_5_2/main/main.c
===================================================================
--- php/php-src/branches/PHP_5_2/main/main.c    2010-06-19 17:01:01 UTC (rev 
300605)
+++ php/php-src/branches/PHP_5_2/main/main.c    2010-06-19 20:47:24 UTC (rev 
300606)
@@ -119,7 +119,7 @@
 static PHP_INI_MH(OnChangeMemoryLimit)
 {
        if (new_value) {
-               PG(memory_limit) = zend_atoi(new_value, new_value_length);
+               PG(memory_limit) = zend_atol(new_value, new_value_length);
        } else {
                PG(memory_limit) = 1<<30;               /* effectively, no 
limit */
        }

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to