]> granicus.if.org Git - php/commitdiff
Merge branch 'PHP-7.3'
authorNikita Popov <nikita.ppv@gmail.com>
Mon, 28 Jan 2019 08:23:53 +0000 (09:23 +0100)
committerNikita Popov <nikita.ppv@gmail.com>
Mon, 28 Jan 2019 08:23:53 +0000 (09:23 +0100)
1  2 
Zend/zend_compile.c

index 6985e1bcaa28ade1e21967282df6a288fff653c4,e22e3f8e3777a3fa6fd6fc9933c81f832beeb285..01c90559db7a48cfd051f4392ee73296d4939c33
@@@ -1331,15 -1477,31 +1331,22 @@@ static void zend_ensure_valid_class_fet
  }
  /* }}} */
  
 -static zend_bool zend_try_compile_const_expr_resolve_class_name(zval *zv, zend_ast *class_ast, zend_ast *name_ast, zend_bool constant) /* {{{ */
 +static zend_bool zend_try_compile_const_expr_resolve_class_name(zval *zv, zend_ast *class_ast) /* {{{ */
  {
        uint32_t fetch_type;
+       zval *class_name;
  
 -      if (name_ast->kind != ZEND_AST_ZVAL) {
 -              return 0;
 -      }
 -
 -      if (!zend_string_equals_literal_ci(zend_ast_get_str(name_ast), "class")) {
 -              return 0;
 -      }
 -
        if (class_ast->kind != ZEND_AST_ZVAL) {
 -              zend_error_noreturn(E_COMPILE_ERROR,
 -                      "Dynamic class names are not allowed in compile-time ::class fetch");
 +              zend_error_noreturn(E_COMPILE_ERROR, "Cannot use ::class with dynamic class name");
        }
  
-       fetch_type = zend_get_class_fetch_type(zend_ast_get_str(class_ast));
+       class_name = zend_ast_get_zval(class_ast);
+       if (Z_TYPE_P(class_name) != IS_STRING) {
+               zend_error_noreturn(E_COMPILE_ERROR, "Illegal class name");
+       }
+       fetch_type = zend_get_class_fetch_type(Z_STR_P(class_name));
        zend_ensure_valid_class_fetch_type(fetch_type);
  
        switch (fetch_type) {