Skip to content

Commit c231bdf

Browse files
committed
Change the way to ensure the constant is defined at runtime in a test-case
1 parent 466d349 commit c231bdf

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

Zend/tests/traits/constant_016.phpt

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
--TEST--
22
Compatibility of values of same name trait constants is checked after their constant expressions are evaluated
3+
--ENV--
4+
ENSURE_CONSTANT_IS_DEFINED_AT_RUNTIME=1
35
--FILE--
46
<?php
57

68
// Ensure CONSTANT is defined at runtime
7-
function define_constant(): void {
8-
eval("define('CONSTANT', 2);");
9+
if ($_ENV['ENSURE_CONSTANT_IS_DEFINED_AT_RUNTIME']) {
10+
define('CONSTANT', 2);
911
}
10-
define_constant();
1112

1213
trait TestTrait {
1314
public const Constant = 40 + CONSTANT;

0 commit comments

Comments
 (0)