Re: [PHP-CVS] svn: /php/php-src/trunk/ NEWS UPGRADING ext/standard/basic_functions.c

2010-10-04 Thread Peter Cowburn
On 1 October 2010 10:18, Kalle Sommer Nielsen ka...@php.net wrote:
 -       PHP_FE(getrandmax,                                                    
                                                           arginfo_getrandmax)
 -       PHP_FE(mt_rand,                                                       
                                                           arginfo_mt_rand)
 +       PHP_DEP_FE(getrandmax,                                                
                                                   arginfo_getrandmax)
 +       PHP_DEP_FE(mt_rand,                                                   
                                                           arginfo_mt_rand)

Looks like you deprecated mt_rand(), oopsie. (Tips hat in mgdm's direction)

        PHP_FE(mt_srand,                                                       
                                                          arginfo_mt_srand)
        PHP_FE(mt_getrandmax,                                                  
                                                  arginfo_mt_getrandmax)



[PHP-CVS] svn: /php/php-src/trunk/ NEWS UPGRADING ext/standard/basic_functions.c

2010-10-04 Thread Kalle Sommer Nielsen
kalleMon, 04 Oct 2010 20:26:50 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=304036

Log:
Revert for now

Changed paths:
U   php/php-src/trunk/NEWS
U   php/php-src/trunk/UPGRADING
U   php/php-src/trunk/ext/standard/basic_functions.c

Modified: php/php-src/trunk/NEWS
===
--- php/php-src/trunk/NEWS  2010-10-04 20:20:30 UTC (rev 304035)
+++ php/php-src/trunk/NEWS  2010-10-04 20:26:50 UTC (rev 304036)
@@ -101,9 +101,6 @@
 - Improved the performance of unserialize(). (galaxy dot mipt at gmail dot com,
   Kalle)

-- Added PHP_RAND_MAX  PHP_MT_RAND_MAX constants to get the maximum random
-  range instead of their counterpart functions. (Kalle)
-
 - Removed legacy features:
   . allow_call_time_pass_reference. (Pierrick)
   . define_syslog_variables ini option and its associated function. (Kalle)
@@ -122,7 +119,6 @@
   PDO_mysql. (Johannes)

 - Deprecated mysql_list_dbs() (Request #50667). (Andrey)
-- Deprecated getrandmax()  mt_getrandmax() in favour of constants. (Kalle)

 - Implemented FR #52555 (Ability to get HTTP response code). (Paul Dragoonis)
 - Implemented FR #51295 (SQLite3::busyTimeout not existing). (Mark)

Modified: php/php-src/trunk/UPGRADING
===
--- php/php-src/trunk/UPGRADING 2010-10-04 20:20:30 UTC (rev 304035)
+++ php/php-src/trunk/UPGRADING 2010-10-04 20:26:50 UTC (rev 304036)
@@ -8,7 +8,6 @@
 4. Changes made to existing methods
 5. Changes made to existing classes
 6. Deprecated
- a. deprecated functions
 7. Extensions:
  a. moved out to PECL and actively maintained there
  b. no longer maintained
@@ -110,11 +109,6 @@
 6. Deprecated
 =

-a. deprecated functions
-
-   - getrandmax()  -- use the PHP_RAND_MAX constant
-   - mt_getrandmax()   -- use the PHP_MT_RAND_MAX constant
-
 ==
 7. Removed
 ==
@@ -241,8 +235,6 @@

- JSON_PRETTY_PRINT
- JSON_UNESCAPED_SLASHES
-   - PHP_RAND_MAX
-   - PHP_MT_RAND_MAX

  g. New classes


Modified: php/php-src/trunk/ext/standard/basic_functions.c
===
--- php/php-src/trunk/ext/standard/basic_functions.c2010-10-04 20:20:30 UTC 
(rev 304035)
+++ php/php-src/trunk/ext/standard/basic_functions.c2010-10-04 20:26:50 UTC 
(rev 304036)
@@ -33,7 +33,6 @@
 #include ext/session/php_session.h
 #include zend_operators.h
 #include ext/standard/php_dns.h
-#include ext/standard/php_rand.h
 #include ext/standard/php_uuencode.h

 #ifdef PHP_WIN32
@@ -2829,7 +2828,7 @@

PHP_FE(rand,
arginfo_rand)
PHP_FE(srand,   
arginfo_srand)
-   PHP_DEP_FE(getrandmax,  
arginfo_getrandmax)
+   PHP_FE(getrandmax,  
arginfo_getrandmax)
PHP_FE(mt_rand, 
arginfo_mt_rand)
PHP_FE(mt_srand,
arginfo_mt_srand)
PHP_DEP_FE(mt_getrandmax,   
arginfo_mt_getrandmax)
@@ -3552,9 +3551,6 @@
REGISTER_MATH_CONSTANT(M_SQRT3);
REGISTER_DOUBLE_CONSTANT(INF, php_get_inf(), CONST_CS | 
CONST_PERSISTENT);
REGISTER_DOUBLE_CONSTANT(NAN, php_get_nan(), CONST_CS | 
CONST_PERSISTENT);
-
-   REGISTER_MATH_CONSTANT(PHP_RAND_MAX);
-   REGISTER_MATH_CONSTANT(PHP_MT_RAND_MAX);

REGISTER_LONG_CONSTANT(PHP_ROUND_HALF_UP, PHP_ROUND_HALF_UP, CONST_CS 
| CONST_PERSISTENT);
REGISTER_LONG_CONSTANT(PHP_ROUND_HALF_DOWN, PHP_ROUND_HALF_DOWN, 
CONST_CS | CONST_PERSISTENT);

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

[PHP-CVS] svn: /php/php-src/trunk/ NEWS UPGRADING ext/standard/basic_functions.c

2010-10-01 Thread Kalle Sommer Nielsen
kalleFri, 01 Oct 2010 09:18:44 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=303912

Log:
* Added PHP_RAND_MAX and PHP_MT_RAND_MAX constants
* Deprecated getrandmax() and mt_getrandmax() in favour of the new constants

# We should promote constants for static data like such instead of function 
calls
# maybe this was just an old left-over

Changed paths:
U   php/php-src/trunk/NEWS
U   php/php-src/trunk/UPGRADING
U   php/php-src/trunk/ext/standard/basic_functions.c

Modified: php/php-src/trunk/NEWS
===
--- php/php-src/trunk/NEWS  2010-10-01 08:54:16 UTC (rev 303911)
+++ php/php-src/trunk/NEWS  2010-10-01 09:18:44 UTC (rev 303912)
@@ -101,6 +101,9 @@
 - Improved the performance of unserialize(). (galaxy dot mipt at gmail dot com,
   Kalle)

+- Added PHP_RAND_MAX  PHP_MT_RAND_MAX constants to get the maximum random
+  range instead of their counterpart functions. (Kalle)
+
 - Removed legacy features:
   . allow_call_time_pass_reference. (Pierrick)
   . define_syslog_variables ini option and its associated function. (Kalle)
@@ -119,6 +122,7 @@
   PDO_mysql. (Johannes)

 - Deprecated mysql_list_dbs() (Request #50667). (Andrey)
+- Deprecated getrandmax()  mt_getrandmax() in favour of constants. (Kalle)

 - Implemented FR #52555 (Ability to get HTTP response code). (Paul Dragoonis)
 - Implemented FR #51295 (SQLite3::busyTimeout not existing). (Mark)

Modified: php/php-src/trunk/UPGRADING
===
--- php/php-src/trunk/UPGRADING 2010-10-01 08:54:16 UTC (rev 303911)
+++ php/php-src/trunk/UPGRADING 2010-10-01 09:18:44 UTC (rev 303912)
@@ -8,6 +8,7 @@
 4. Changes made to existing methods
 5. Changes made to existing classes
 6. Deprecated
+ a. deprecated functions
 7. Extensions:
  a. moved out to PECL and actively maintained there
  b. no longer maintained
@@ -109,8 +110,11 @@
 6. Deprecated
 =

--
+a. deprecated functions

+   - getrandmax()  -- use the PHP_RAND_MAX constant
+   - mt_getrandmax()   -- use the PHP_MT_RAND_MAX constant
+
 ==
 7. Removed
 ==
@@ -237,6 +241,8 @@

- JSON_PRETTY_PRINT
- JSON_UNESCAPED_SLASHES
+   - PHP_RAND_MAX
+   - PHP_MT_RAND_MAX

  g. New classes


Modified: php/php-src/trunk/ext/standard/basic_functions.c
===
--- php/php-src/trunk/ext/standard/basic_functions.c2010-10-01 08:54:16 UTC 
(rev 303911)
+++ php/php-src/trunk/ext/standard/basic_functions.c2010-10-01 09:18:44 UTC 
(rev 303912)
@@ -33,6 +33,7 @@
 #include ext/session/php_session.h
 #include zend_operators.h
 #include ext/standard/php_dns.h
+#include ext/standard/php_rand.h
 #include ext/standard/php_uuencode.h

 #ifdef PHP_WIN32
@@ -2828,8 +2829,8 @@

PHP_FE(rand,
arginfo_rand)
PHP_FE(srand,   
arginfo_srand)
-   PHP_FE(getrandmax,  
arginfo_getrandmax)
-   PHP_FE(mt_rand, 
arginfo_mt_rand)
+   PHP_DEP_FE(getrandmax,  
arginfo_getrandmax)
+   PHP_DEP_FE(mt_rand, 
arginfo_mt_rand)
PHP_FE(mt_srand,
arginfo_mt_srand)
PHP_FE(mt_getrandmax,   
arginfo_mt_getrandmax)

@@ -3551,6 +3552,9 @@
REGISTER_MATH_CONSTANT(M_SQRT3);
REGISTER_DOUBLE_CONSTANT(INF, php_get_inf(), CONST_CS | 
CONST_PERSISTENT);
REGISTER_DOUBLE_CONSTANT(NAN, php_get_nan(), CONST_CS | 
CONST_PERSISTENT);
+
+   REGISTER_MATH_CONSTANT(PHP_RAND_MAX);
+   REGISTER_MATH_CONSTANT(PHP_MT_RAND_MAX);

REGISTER_LONG_CONSTANT(PHP_ROUND_HALF_UP, PHP_ROUND_HALF_UP, CONST_CS 
| CONST_PERSISTENT);
REGISTER_LONG_CONSTANT(PHP_ROUND_HALF_DOWN, PHP_ROUND_HALF_DOWN, 
CONST_CS | CONST_PERSISTENT);

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

Re: [PHP-CVS] svn: /php/php-src/trunk/ NEWS UPGRADING ext/standard/basic_functions.c

2010-10-01 Thread Pierre Joye
On Fri, Oct 1, 2010 at 11:18 AM, Kalle Sommer Nielsen ka...@php.net wrote:
 kalle                                    Fri, 01 Oct 2010 09:18:44 +

 Revision: http://svn.php.net/viewvc?view=revisionrevision=303912

 Log:
 * Added PHP_RAND_MAX and PHP_MT_RAND_MAX constants
 * Deprecated getrandmax() and mt_getrandmax() in favour of the new constants

What is the reasoning behind that? It could be possible that the
max/min has to be defined at runtime at some point.

Cheers,
-- 
Pierre

@pierrejoye | http://blog.thepimp.net | http://www.libgd.org

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



Re: [PHP-CVS] svn: /php/php-src/trunk/ NEWS UPGRADING ext/standard/basic_functions.c

2010-10-01 Thread Kalle Sommer Nielsen
 What is the reasoning behind that? It could be possible that the
 max/min has to be defined at runtime at some point.

Define at runtime? The values those functions expose are from compile
time constants. I do not see why we need a function call to get a
statically defined value.

Also, there is no min value


-- 
regards,

Kalle Sommer Nielsen
ka...@php.net

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



Re: [PHP-CVS] svn: /php/php-src/trunk/ NEWS UPGRADING ext/standard/basic_functions.c

2010-10-01 Thread Pierre Joye
On Fri, Oct 1, 2010 at 12:08 PM, Kalle Sommer Nielsen ka...@php.net wrote:
 What is the reasoning behind that? It could be possible that the
 max/min has to be defined at runtime at some point.

 Define at runtime?

'possible', 'at some point' (new RNG implementation).

In any case, I don't see any gain to deprecate them for the sake of
adding constants. Please revert the deprecation, I'm sure about the
constant additions as they could be useless later (same reason).

Cheers,
-- 
Pierre

@pierrejoye | http://blog.thepimp.net | http://www.libgd.org

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