Skip to content

Commit 62b21b1

Browse files
committed
Fix crash on (unset) cast in constant property initializer
1 parent 043f361 commit 62b21b1

3 files changed

Lines changed: 17 additions & 6 deletions

File tree

Zend/tests/ast/gh21072.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@ try {
1212
}
1313
?>
1414
--EXPECTF--
15-
Fatal error: The (unset) cast is no longer supported in %s on line %d
15+
Fatal error: The (unset) cast is no longer supported in %s on line %d

Zend/zend_ast.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -814,11 +814,6 @@ static zend_result ZEND_FASTCALL zend_ast_evaluate_inner(
814814
case IS_OBJECT:
815815
zend_cast_zval_to_object(result, &op1, IS_VAR);
816816
break;
817-
case IS_NULL:
818-
zend_throw_error(NULL,
819-
"Invalid cast in constant expression");
820-
ret = FAILURE;
821-
break;
822817
EMPTY_SWITCH_DEFAULT_CASE();
823818
}
824819
zval_ptr_dtor_nogc(&op1);

ext/fileinfo/tests/bug.phpt

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
--TEST--
2+
finfo_open() works with Unicode magic file path (bug #71527)
3+
--EXTENSIONS--
4+
fileinfo
5+
--INI--
6+
display_errors=1
7+
display_startup_errors=1
8+
error_reporting=E_ALL
9+
--FILE--
10+
<?php
11+
$magic = __DIR__ . DIRECTORY_SEPARATOR . "bug71527私はガラスを食べられます.magic";
12+
$finfo = finfo_open(FILEINFO_NONE, $magic);
13+
var_dump($finfo instanceof finfo);
14+
?>
15+
--EXPECT--
16+
bool(true)

0 commit comments

Comments
 (0)