]> granicus.if.org Git - php/commitdiff
Merge branch 'PHP-5.6' into PHP-7.0
authorChristoph M. Becker <cmbecker69@gmx.de>
Fri, 9 Sep 2016 12:33:01 +0000 (14:33 +0200)
committerChristoph M. Becker <cmbecker69@gmx.de>
Fri, 9 Sep 2016 12:34:11 +0000 (14:34 +0200)
1  2 
NEWS
ext/filter/filter.c

diff --cc NEWS
index cf13e4ad8d61b23262aed32b9db625c5b877127f,831293f7ccf2ad1cec57ccfb6c11d17bd66d7b2d..3b848264ae4452f0bf7260f0f6b04c6c70a35708
--- 1/NEWS
--- 2/NEWS
+++ b/NEWS
@@@ -9,6 -9,10 +9,8 @@@ PH
  - Filter:
    . Fixed bug #72972 (Bad filter for the flags FILTER_FLAG_NO_RES_RANGE and
      FILTER_FLAG_NO_PRIV_RANGE). (julien)
 -  . Fixed bug #67167 (Wrong return value from FILTER_VALIDATE_BOOLEAN,
 -    FILTER_NULL_ON_FAILURE). (levim, cmb)
+   . Fixed bug #73054 (default option ignored when object passed to int filter).
+     (cmb)
  
  - GD:
    . Fixed bug #67325 (imagetruecolortopalette: white is duplicated in palette).
index 2c8dde9d49ae877877eccaf496c8f5a733b4f1c2,5b79667bd9a68977a9b4f7505223a8e216e04908..613c0b75ea13d5c3f89571bd253d16ac861b43fc
@@@ -383,34 -375,37 +383,35 @@@ static void php_zval_filter(zval *value
  
        /* #49274, fatal error with object without a toString method
          Fails nicely instead of getting a recovarable fatal error. */
 -      if (Z_TYPE_PP(value) == IS_OBJECT) {
 +      if (Z_TYPE_P(value) == IS_OBJECT) {
                zend_class_entry *ce;
  
 -              ce = Z_OBJCE_PP(value);
 +              ce = Z_OBJCE_P(value);
                if (!ce->__tostring) {
 -                      zval_dtor(*value);
 +                      zval_ptr_dtor(value);
                        /* #67167: doesn't return null on failure for objects */
                        if (flags & FILTER_NULL_ON_FAILURE) {
 -                              ZVAL_NULL(*value);
 +                              ZVAL_NULL(value);
                        } else {
 -                              ZVAL_FALSE(*value);
 +                              ZVAL_FALSE(value);
                        }
-                       return;
+                       goto handle_default;
                }
        }
  
        /* Here be strings */
 -      convert_to_string(*value);
 +      convert_to_string(value);
  
 -      filter_func.function(*value, flags, options, charset TSRMLS_CC);
 +      filter_func.function(value, flags, options, charset);
  
 -      if (
 -              options && (Z_TYPE_P(options) == IS_ARRAY || Z_TYPE_P(options) == IS_OBJECT) &&
 -              ((flags & FILTER_NULL_ON_FAILURE && Z_TYPE_PP(value) == IS_NULL) || 
 -              (!(flags & FILTER_NULL_ON_FAILURE) && Z_TYPE_PP(value) == IS_BOOL && Z_LVAL_PP(value) == 0)) &&
 -              zend_hash_exists(HASH_OF(options), "default", sizeof("default"))
 -      ) {
 -              zval **tmp; 
 -              if (zend_hash_find(HASH_OF(options), "default", sizeof("default"), (void **)&tmp) == SUCCESS) {
 -                      MAKE_COPY_ZVAL(tmp, *value);
+ handle_default:
 +      if (options && (Z_TYPE_P(options) == IS_ARRAY || Z_TYPE_P(options) == IS_OBJECT) &&
 +              ((flags & FILTER_NULL_ON_FAILURE && Z_TYPE_P(value) == IS_NULL) ||
 +              (!(flags & FILTER_NULL_ON_FAILURE) && Z_TYPE_P(value) == IS_FALSE)) &&
 +              zend_hash_str_exists(HASH_OF(options), "default", sizeof("default") - 1)) {
 +              zval *tmp;
 +              if ((tmp = zend_hash_str_find(HASH_OF(options), "default", sizeof("default") - 1)) != NULL) {
 +                      ZVAL_COPY(value, tmp);
                }
        }
  }