Skip to content

Commit

Permalink
Fixed test in php8.4
Browse files Browse the repository at this point in the history
  • Loading branch information
laruence committed Feb 24, 2025
1 parent 40e7bf3 commit 056aa40
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 6 deletions.
7 changes: 5 additions & 2 deletions tests/038.phpt
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
--TEST--
Check for Yaf_View_Simple error message outputing
--SKIPIF--
<?php if (!extension_loaded("yaf")) print "skip"; ?>
<?php
if (!extension_loaded("yaf")) die("skip");
if (version_compare(PHP_VERSION, "8.4", "ge")) print "skip only for <= 8.3";
?>
--INI--
yaf.library="/php/global/dir"
log_errors=0
Expand Down Expand Up @@ -34,4 +37,4 @@ require "build.inc";
shutdown();
?>
--EXPECTF--
Parse error: syntax error, unexpected %s}%c in %sfoo.phtml on line %d
Parse error: syntax error, unexpected %s}%c in %sfoo.phtml on line %d
23 changes: 19 additions & 4 deletions tests/039.phpt
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
--TEST--
Check for Yaf_View_Simple recursive render error message outputing
--SKIPIF--
<?php if (!extension_loaded("yaf")) print "skip"; ?>
<?php
if (!extension_loaded("yaf")) die("skip");
?>
--INI--
yaf.library="/php/global/dir"
log_errors=0
Expand Down Expand Up @@ -35,7 +37,20 @@ HTML
try {
echo $view->render($tpl, array('tpl' => $tpl2));
} catch (Error $e) {
echo $e->getMessage();
$msg = $e->getMessage();
if (version_compare(PHP_VERSION, "8.4", "ge")) {
if (strcmp("syntax error, unexpected token \"{\"", $msg) == 0) {
echo "okey";
} else {
echo $msg;
}
} else {
if (strcmp("syntax error, unexpected token \"}\"", $msg) == 0) {
echo "okey";
} else {
echo $msg;
}
}
}
?>
--CLEAN--
Expand All @@ -44,5 +59,5 @@ try {
require "build.inc";
shutdown();
?>
--EXPECTF--
syntax error, unexpected %s}%c
--EXPECT--
okey

0 comments on commit 056aa40

Please sign in to comment.