diff options
Diffstat (limited to 'ext/standard')
-rw-r--r-- | ext/standard/array.c | 4 | ||||
-rw-r--r-- | ext/standard/basic_functions.c | 2 | ||||
-rw-r--r-- | ext/standard/ftp_fopen_wrapper.c | 6 | ||||
-rw-r--r-- | ext/standard/http_fopen_wrapper.c | 4 | ||||
-rw-r--r-- | ext/standard/math.c | 38 | ||||
-rw-r--r-- | ext/standard/tests/math/pow-operator.phpt | 22 | ||||
-rw-r--r-- | ext/standard/tests/math/pow_variation1.phpt | 2 | ||||
-rw-r--r-- | ext/standard/tests/math/pow_variation1_64bit.phpt | 4 | ||||
-rw-r--r-- | ext/standard/type.c | 2 |
9 files changed, 35 insertions, 49 deletions
diff --git a/ext/standard/array.c b/ext/standard/array.c index e84e019690..6642bc2c7b 100644 --- a/ext/standard/array.c +++ b/ext/standard/array.c @@ -4277,7 +4277,7 @@ PHP_FUNCTION(array_filter) fci.params = args; if (zend_call_function(&fci, &fci_cache TSRMLS_CC) == SUCCESS && retval) { - int retval_true = zend_is_true(retval); + int retval_true = zend_is_true(retval TSRMLS_CC); zval_ptr_dtor(&retval); if (use_type) { @@ -4290,7 +4290,7 @@ PHP_FUNCTION(array_filter) php_error_docref(NULL TSRMLS_CC, E_WARNING, "An error occurred while invoking the filter callback"); return; } - } else if (!zend_is_true(*operand)) { + } else if (!zend_is_true(*operand TSRMLS_CC)) { continue; } diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c index 4f50ce6038..6409ff37d8 100644 --- a/ext/standard/basic_functions.c +++ b/ext/standard/basic_functions.c @@ -5751,7 +5751,7 @@ PHP_FUNCTION(register_tick_function) zend_llist_init(BG(user_tick_functions), sizeof(user_tick_function_entry), (llist_dtor_func_t) user_tick_function_dtor, 0); - php_add_tick_function(run_user_tick_functions); + php_add_tick_function(run_user_tick_functions TSRMLS_CC); } for (i = 0; i < tick_fe.arg_count; i++) { diff --git a/ext/standard/ftp_fopen_wrapper.c b/ext/standard/ftp_fopen_wrapper.c index d6eb3b8fbc..df03772c39 100644 --- a/ext/standard/ftp_fopen_wrapper.c +++ b/ext/standard/ftp_fopen_wrapper.c @@ -163,7 +163,7 @@ static php_stream *php_ftp_fopen_connect(php_stream_wrapper *wrapper, const char goto connect_errexit; } - php_stream_context_set(stream, context); + php_stream_context_set(stream, context TSRMLS_CC); php_stream_notify_info(context, PHP_STREAM_NOTIFY_CONNECT, NULL, 0); /* Start talking to ftp server */ @@ -571,7 +571,7 @@ php_stream * php_stream_url_wrap_ftp(php_stream_wrapper *wrapper, const char *pa goto errexit; } - php_stream_context_set(datastream, context); + php_stream_context_set(datastream, context TSRMLS_CC); php_stream_notify_progress_init(context, 0, file_size); if (use_ssl_on_data && (php_stream_xport_crypto_setup(datastream, @@ -745,7 +745,7 @@ php_stream * php_stream_ftp_opendir(php_stream_wrapper *wrapper, const char *pat goto opendir_errexit; } - php_stream_context_set(datastream, context); + php_stream_context_set(datastream, context TSRMLS_CC); if (use_ssl_on_data && (php_stream_xport_crypto_setup(stream, STREAM_CRYPTO_METHOD_SSLv23_CLIENT, NULL TSRMLS_CC) < 0 || diff --git a/ext/standard/http_fopen_wrapper.c b/ext/standard/http_fopen_wrapper.c index 73776ff0b9..3ef722bde0 100644 --- a/ext/standard/http_fopen_wrapper.c +++ b/ext/standard/http_fopen_wrapper.c @@ -337,7 +337,7 @@ finish: eol_detect = stream->flags & (PHP_STREAM_FLAG_DETECT_EOL | PHP_STREAM_FLAG_EOL_MAC); stream->flags &= ~(PHP_STREAM_FLAG_DETECT_EOL | PHP_STREAM_FLAG_EOL_MAC); - php_stream_context_set(stream, context); + php_stream_context_set(stream, context TSRMLS_CC); php_stream_notify_info(context, PHP_STREAM_NOTIFY_CONNECT, NULL, 0); @@ -682,7 +682,7 @@ finish: response_code = 0; } if (context && SUCCESS==php_stream_context_get_option(context, "http", "ignore_errors", &tmpzval)) { - ignore_errors = zend_is_true(*tmpzval); + ignore_errors = zend_is_true(*tmpzval TSRMLS_CC); } /* when we request only the header, don't fail even on error codes */ if ((options & STREAM_ONLY_GET_HEADERS) || ignore_errors) { diff --git a/ext/standard/math.c b/ext/standard/math.c index 2be049f200..65702ddf14 100644 --- a/ext/standard/math.c +++ b/ext/standard/math.c @@ -604,43 +604,7 @@ PHP_FUNCTION(pow) return; } - /* make sure we're dealing with numbers */ - convert_scalar_to_number(zbase TSRMLS_CC); - convert_scalar_to_number(zexp TSRMLS_CC); - - /* if both base and exponent were longs, we'll try to get a long out */ - if (Z_TYPE_P(zbase) == IS_LONG && Z_TYPE_P(zexp) == IS_LONG && Z_LVAL_P(zexp) >= 0) { - long l1 = 1, l2 = Z_LVAL_P(zbase), i = Z_LVAL_P(zexp); - - if (i == 0) { - RETURN_LONG(1L); - } else if (l2 == 0) { - RETURN_LONG(0); - } - - /* calculate pow(long,long) in O(log exp) operations, bail if overflow */ - while (i >= 1) { - long overflow; - double dval = 0.0; - - if (i % 2) { - --i; - ZEND_SIGNED_MULTIPLY_LONG(l1,l2,l1,dval,overflow); - if (overflow) RETURN_DOUBLE(dval * pow(l2,i)); - } else { - i /= 2; - ZEND_SIGNED_MULTIPLY_LONG(l2,l2,l2,dval,overflow); - if (overflow) RETURN_DOUBLE((double)l1 * pow(dval,i)); - } - if (i == 0) { - RETURN_LONG(l1); - } - } - } - convert_to_double(zbase); - convert_to_double(zexp); - - RETURN_DOUBLE(pow(Z_DVAL_P(zbase), Z_DVAL_P(zexp))); + pow_function(return_value, zbase, zexp TSRMLS_CC); } /* }}} */ diff --git a/ext/standard/tests/math/pow-operator.phpt b/ext/standard/tests/math/pow-operator.phpt new file mode 100644 index 0000000000..f80cae1962 --- /dev/null +++ b/ext/standard/tests/math/pow-operator.phpt @@ -0,0 +1,22 @@ +--TEST-- +Various pow() tests +--FILE-- +<?php // $Id$ + +$x = 2; +$x **= 3; + +$tests = <<<TESTS + -3 ** 2 === -9 + (-3) **2 === 9 + 2 ** 3 ** 2 === 512 + (2 ** 3) ** 2 === 64 + $x === 8 +TESTS; + + echo "On failure, please mail result to php-dev@lists.php.net\n"; + include(dirname(__FILE__) . '/../../../../tests/quicktester.inc'); + +--EXPECT-- +On failure, please mail result to php-dev@lists.php.net +OK diff --git a/ext/standard/tests/math/pow_variation1.phpt b/ext/standard/tests/math/pow_variation1.phpt index df511906b0..5576e5b493 100644 --- a/ext/standard/tests/math/pow_variation1.phpt +++ b/ext/standard/tests/math/pow_variation1.phpt @@ -149,7 +149,7 @@ int(0) int(0) -- Iteration 19 -- -float(0) +int(0) -- Iteration 20 -- int(0) diff --git a/ext/standard/tests/math/pow_variation1_64bit.phpt b/ext/standard/tests/math/pow_variation1_64bit.phpt index 24b482680b..e1986ba858 100644 --- a/ext/standard/tests/math/pow_variation1_64bit.phpt +++ b/ext/standard/tests/math/pow_variation1_64bit.phpt @@ -149,7 +149,7 @@ int(0) int(0) -- Iteration 19 -- -float(0) +int(0) -- Iteration 20 -- int(0) @@ -173,4 +173,4 @@ int(0) -- Iteration 26 -- %s -===Done===
\ No newline at end of file +===Done=== diff --git a/ext/standard/type.c b/ext/standard/type.c index dcc8083e41..15bdbb06c2 100644 --- a/ext/standard/type.c +++ b/ext/standard/type.c @@ -186,7 +186,7 @@ PHP_FUNCTION(boolval) return; } - RETURN_BOOL(zend_is_true(*val)); + RETURN_BOOL(zend_is_true(*val TSRMLS_CC)); } /* }}} */ |