diff options
| author | Ben Fuhrmannek | 2015-02-07 20:44:24 +0100 |
|---|---|---|
| committer | Ben Fuhrmannek | 2015-02-07 20:44:24 +0100 |
| commit | b5be229cb7445f02e0bef8c47cb3de6355b5fd3b (patch) | |
| tree | 10bab3bb94102e31d290bc44173ee9c61962b860 | |
| parent | 25cc24e11ab3c3e2447d18195c267ccd5df27b85 (diff) | |
refactored srand()
| -rw-r--r-- | execute.c | 26 |
1 files changed, 14 insertions, 12 deletions
| @@ -1426,21 +1426,23 @@ static php_uint32 suhosin_rand(TSRMLS_D) | |||
| 1426 | 1426 | ||
| 1427 | static int ih_srand(IH_HANDLER_PARAMS) | 1427 | static int ih_srand(IH_HANDLER_PARAMS) |
| 1428 | { | 1428 | { |
| 1429 | int argc = ZEND_NUM_ARGS(); | 1429 | int argc = ZEND_NUM_ARGS(); |
| 1430 | long seed; | 1430 | long seed; |
| 1431 | 1431 | ||
| 1432 | if (zend_parse_parameters(argc TSRMLS_CC, "|l", &seed) == FAILURE || SUHOSIN_G(srand_ignore)) { | 1432 | if (SUHOSIN_G(srand_ignore)) { |
| 1433 | if (SUHOSIN_G(srand_ignore)) { | 1433 | SUHOSIN_G(r_is_seeded) = 0; |
| 1434 | SUHOSIN_G(r_is_seeded) = 0; | 1434 | return 1; |
| 1435 | } | 1435 | } |
| 1436 | return (1); | 1436 | |
| 1437 | } | 1437 | if (zend_parse_parameters(argc TSRMLS_CC, "|l", &seed) == FAILURE) { |
| 1438 | return 1; | ||
| 1439 | } | ||
| 1438 | 1440 | ||
| 1439 | if (argc == 0) { | 1441 | if (argc) { |
| 1440 | suhosin_srand_auto(TSRMLS_C); | 1442 | suhosin_srand(seed TSRMLS_CC); |
| 1441 | } else { | 1443 | } else { |
| 1442 | suhosin_srand(seed TSRMLS_CC); | 1444 | suhosin_srand_auto(TSRMLS_C); |
| 1443 | } | 1445 | } |
| 1444 | return (1); | 1446 | return (1); |
| 1445 | } | 1447 | } |
| 1446 | 1448 | ||
