xref: /PHP-8.1/Zend/tests/assert/expect_007.phpt (revision 482985ca)
1--TEST--
2test compiled reason
3--INI--
4zend.assertions=1
5assert.exception=1
6--FILE--
7<?php
8$next = 1;
9$data = array(
10    "key" => "X-HTTP ",
11    "value" => "testing"
12);
13
14class HeaderMalfunctionError extends AssertionError {}
15
16assert (preg_match("~^([a-zA-Z0-9-]+)$~", $data["key"]), new HeaderMalfunctionError("malformed key found at {$next} \"{$data["key"]}\""));
17?>
18--EXPECTF--
19Fatal error: Uncaught HeaderMalfunctionError: malformed key found at 1 "X-HTTP " in %sexpect_007.php:10
20Stack trace:
21#0 {main}
22  thrown in %sexpect_007.php on line 10
23