summaryrefslogtreecommitdiff
path: root/Zend/zend_API.h
diff options
context:
space:
mode:
authorAnatol Belski <ab@php.net>2014-12-13 19:43:45 +0100
committerAnatol Belski <ab@php.net>2014-12-13 19:43:45 +0100
commitbb66f385d09e7e55390e9f57fcbca08f6b43ff91 (patch)
tree54defb44e55c1ebc0afa15aa60758d87a4b9ce3b /Zend/zend_API.h
parentdfb18b1188492efa48ade07029172c5535f65f93 (diff)
parent0ea0b591d79ae0ee18d33533a5c701330836ff6b (diff)
downloadphp-git-bb66f385d09e7e55390e9f57fcbca08f6b43ff91.tar.gz
Merge remote-tracking branch 'origin/master' into native-tls
* origin/master: (37 commits) NEWS NEWS Fix bug #68601 buffer read overflow in gd_gif_in.c Fixed compilation warnings Removed unnecessary checks pcntl_signal_dispatch: Speed up by preventing system calls when unnecessary Merged PR #911. Removed ZEND_ACC_FINAL_CLASS which is unnecessary. This also fixed some currently defined classes as final which were just not being considered as such before. Updated NEWS Updated NEWS Updated NEWS Fix bug #68532: convert.base64-encode omits padding bytes Updated NEWS Updated NEWS Updated NEWS Fixed Bug #65576 (Constructor from trait conflicts with inherited constructor) Updated NEWS Updated NEWS Fix MySQLi tests Fixed gd test ...
Diffstat (limited to 'Zend/zend_API.h')
-rw-r--r--Zend/zend_API.h29
1 files changed, 20 insertions, 9 deletions
diff --git a/Zend/zend_API.h b/Zend/zend_API.h
index bee797b7da..1e031ca844 100644
--- a/Zend/zend_API.h
+++ b/Zend/zend_API.h
@@ -525,7 +525,7 @@ ZEND_API zend_array *zend_rebuild_symbol_table(TSRMLS_D);
ZEND_API void zend_attach_symbol_table(zend_execute_data *execute_data);
ZEND_API void zend_detach_symbol_table(zend_execute_data *execute_data);
ZEND_API int zend_set_local_var(zend_string *name, zval *value, int force TSRMLS_DC);
-ZEND_API int zend_set_local_var_str(const char *name, int len, zval *value, int force TSRMLS_DC);
+ZEND_API int zend_set_local_var_str(const char *name, size_t len, zval *value, int force TSRMLS_DC);
ZEND_API zend_string *zend_find_alias_name(zend_class_entry *ce, zend_string *name);
ZEND_API zend_string *zend_resolve_method_name(zend_class_entry *ce, zend_function *f);
@@ -1064,10 +1064,16 @@ static zend_always_inline int _z_param_long(zval *arg, zend_long *dest, zend_boo
if (EXPECTED(Z_TYPE_P(arg) == IS_LONG)) {
*dest = Z_LVAL_P(arg);
} else if (EXPECTED(Z_TYPE_P(arg) == IS_DOUBLE)) {
- if (strict && UNEXPECTED(Z_DVAL_P(arg) > ZEND_LONG_MAX)) {
- *dest = ZEND_LONG_MAX;
- } else if (strict && UNEXPECTED(Z_DVAL_P(arg) < ZEND_LONG_MIN)) {
- *dest = ZEND_LONG_MIN;
+ if (UNEXPECTED(zend_isnan(Z_DVAL_P(arg)))) {
+ return 0;
+ }
+ if (UNEXPECTED(!ZEND_DOUBLE_FITS_LONG(Z_DVAL_P(arg)))) {
+ /* Ironically, the strict parameter makes zpp *non*-strict here */
+ if (strict) {
+ *dest = (Z_DVAL_P(arg) > 0) ? ZEND_LONG_MAX : ZEND_LONG_MIN;
+ } else {
+ return 0;
+ }
} else {
*dest = zend_dval_to_lval(Z_DVAL_P(arg));
}
@@ -1077,10 +1083,15 @@ static zend_always_inline int _z_param_long(zval *arg, zend_long *dest, zend_boo
if (UNEXPECTED((type = is_numeric_str_function(Z_STR_P(arg), dest, &d)) != IS_LONG)) {
if (EXPECTED(type != 0)) {
- if (strict && UNEXPECTED(d > ZEND_LONG_MAX)) {
- *dest = ZEND_LONG_MAX;
- } else if (strict && UNEXPECTED(d < ZEND_LONG_MIN)) {
- *dest = ZEND_LONG_MIN;
+ if (UNEXPECTED(zend_isnan(d))) {
+ return 0;
+ }
+ if (UNEXPECTED(!ZEND_DOUBLE_FITS_LONG(d))) {
+ if (strict) {
+ *dest = (d > 0) ? ZEND_LONG_MAX : ZEND_LONG_MIN;
+ } else {
+ return 0;
+ }
} else {
*dest = zend_dval_to_lval(d);
}