]> granicus.if.org Git - php/commitdiff
Merge branch 'PHP-7.1'
authorXinchen Hui <laruence@gmail.com>
Wed, 31 May 2017 05:12:24 +0000 (13:12 +0800)
committerXinchen Hui <laruence@gmail.com>
Wed, 31 May 2017 05:12:24 +0000 (13:12 +0800)
* PHP-7.1:
  Update NEWS
  Fixed bug #74673 (Segfault when cast Reflection object to string with undefined constant)

Conflicts:
ext/reflection/php_reflection.c

1  2 
ext/reflection/php_reflection.c

index b8c984a8bfc38776dd7429b59421497a9400b316,db7056e03b7071d15858224c1c6c472ec58ef401..3e5af0dbb87cbb600b510ff9289600fa2da48fe8
@@@ -379,10 -467,13 +379,13 @@@ static void _class_string(smart_str *st
                zend_class_constant *c;
  
                ZEND_HASH_FOREACH_STR_KEY_PTR(&ce->constants_table, key, c) {
 -                      _class_const_string(str, ZSTR_VAL(key), c, ZSTR_VAL(sub_indent.buf));
 +                      _class_const_string(str, ZSTR_VAL(key), c, ZSTR_VAL(sub_indent));
+                       if (UNEXPECTED(EG(exception))) {
+                               return;
+                       }
                } ZEND_HASH_FOREACH_END();
        }
 -      string_printf(str, "%s  }\n", indent);
 +      smart_str_append_printf(str, "%s  }\n", indent);
  
        /* Static properties */
        /* counting static properties */
@@@ -635,27 -733,30 +638,30 @@@ static void _parameter_string(smart_st
                if (precv && precv->opcode == ZEND_RECV_INIT && precv->op2_type != IS_UNUSED) {
                        zval zv;
  
 -                      string_write(str, " = ", sizeof(" = ")-1);
 +                      smart_str_appends(str, " = ");
                        ZVAL_DUP(&zv, RT_CONSTANT(&fptr->op_array, precv->op2));
-                       zval_update_constant_ex(&zv, fptr->common.scope);
+                       if (UNEXPECTED(zval_update_constant_ex(&zv, fptr->common.scope) == FAILURE)) {
+                               zval_ptr_dtor(&zv);
+                               return;
+                       }
                        if (Z_TYPE(zv) == IS_TRUE) {
 -                              string_write(str, "true", sizeof("true")-1);
 +                              smart_str_appends(str, "true");
                        } else if (Z_TYPE(zv) == IS_FALSE) {
 -                              string_write(str, "false", sizeof("false")-1);
 +                              smart_str_appends(str, "false");
                        } else if (Z_TYPE(zv) == IS_NULL) {
 -                              string_write(str, "NULL", sizeof("NULL")-1);
 +                              smart_str_appends(str, "NULL");
                        } else if (Z_TYPE(zv) == IS_STRING) {
 -                              string_write(str, "'", sizeof("'")-1);
 -                              string_write(str, Z_STRVAL(zv), MIN(Z_STRLEN(zv), 15));
 +                              smart_str_appendc(str, '\'');
 +                              smart_str_appendl(str, Z_STRVAL(zv), MIN(Z_STRLEN(zv), 15));
                                if (Z_STRLEN(zv) > 15) {
 -                                      string_write(str, "...", sizeof("...")-1);
 +                                      smart_str_appends(str, "...");
                                }
 -                              string_write(str, "'", sizeof("'")-1);
 +                              smart_str_appendc(str, '\'');
                        } else if (Z_TYPE(zv) == IS_ARRAY) {
 -                              string_write(str, "Array", sizeof("Array")-1);
 +                              smart_str_appends(str, "Array");
                        } else {
                                zend_string *zv_str = zval_get_string(&zv);
 -                              string_write(str, ZSTR_VAL(zv_str), ZSTR_LEN(zv_str));
 +                              smart_str_append(str, zv_str);
                                zend_string_release(zv_str);
                        }
                        zval_ptr_dtor(&zv);