language/predefined/errorexception.xml
e6376e04ed2526138e5b71e16168cf6bb269fa8a
...
...
@@ -1,11 +1,6 @@
1
1
<?xml version="1.0" encoding="utf-8"?>
2
2
<!-- $Revision$ -->
3
-

4
-
<phpdoc:exceptionref xml:id="class.errorexception"
5
-
xmlns="http://docbook.org/ns/docbook"
6
-
xmlns:xlink="http://www.w3.org/1999/xlink"
7
-
xmlns:xi="http://www.w3.org/2001/XInclude"
8
-
xmlns:phpdoc="http://php.net/ns/phpdoc">
3
+
<phpdoc:exceptionref xml:id="class.errorexception" xmlns:phpdoc="http://php.net/ns/phpdoc" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xi="http://www.w3.org/2001/XInclude">
9
4
<title>ErrorException</title>
10
5
<titleabbrev>ErrorException</titleabbrev>
11
6
...
...
@@ -24,38 +19,41 @@
24
19
&reftitle.classsynopsis;
25
20
26
21
<!-- {{{ Synopsis -->
27
-
<classsynopsis>
28
-
<ooclass><classname>ErrorException</classname></ooclass>
29
-
30
-
<!-- {{{ Class synopsis -->
31
-
<classsynopsisinfo>
32
-
<ooclass>
33
-
<classname>ErrorException</classname>
34
-
</ooclass>
22
+
<classsynopsis class="class">
23
+
<ooexception>
24
+
<exceptionname>ErrorException</exceptionname>
25
+
</ooexception>
35
26

36
-
<ooclass>
37
-
<modifier>extends</modifier>
38
-
<classname>Exception</classname>
39
-
</ooclass>
40
-
</classsynopsisinfo>
41
-
<!-- }}} -->
27
+
<ooclass>
28
+
<modifier>extends</modifier>
29
+
<classname>Exception</classname>
30
+
</ooclass>
42
31

43
32
<classsynopsisinfo role="comment">&Properties;</classsynopsisinfo>
44
33
<fieldsynopsis>
45
34
<modifier>protected</modifier>
46
35
<type>int</type>
47
36
<varname linkend="errorexception.props.severity">severity</varname>
37
+
<initializer>E_ERROR</initializer>
48
38
</fieldsynopsis>
49
39

50
40
<classsynopsisinfo role="comment">&InheritedProperties;</classsynopsisinfo>
51
-
<xi:include xpointer="xmlns(db=http://docbook.org/ns/docbook) xpointer(id('exception.synopsis')/descendant::db:fieldsynopsis)" />
41
+
<xi:include xpointer="xmlns(db=http://docbook.org/ns/docbook) xpointer(id('class.exception')/db:partintro/db:section/db:classsynopsis/db:fieldsynopsis[preceding-sibling::db:classsynopsisinfo[1][@role='comment' and text()='&Properties;']]))">
42
+
<xi:fallback/>
43
+
</xi:include>
52
44

53
45
<classsynopsisinfo role="comment">&Methods;</classsynopsisinfo>
54
-
<xi:include xpointer="xmlns(db=http://docbook.org/ns/docbook) xpointer(id('class.errorexception')/db:refentry/db:refsect1[@role='description']/descendant::db:constructorsynopsis[1])" />
55
-
<xi:include xpointer="xmlns(db=http://docbook.org/ns/docbook) xpointer(id('class.errorexception')/db:refentry/db:refsect1[@role='description']/descendant::db:methodsynopsis[1])" />
46
+
<xi:include xpointer="xmlns(db=http://docbook.org/ns/docbook) xpointer(id('class.errorexception')/db:refentry/db:refsect1[@role='description']/descendant::db:constructorsynopsis[@role='ErrorException'])">
47
+
<xi:fallback/>
48
+
</xi:include>
49
+
<xi:include xpointer="xmlns(db=http://docbook.org/ns/docbook) xpointer(id('class.errorexception')/db:refentry/db:refsect1[@role='description']/descendant::db:methodsynopsis[@role='ErrorException'])">
50
+
<xi:fallback/>
51
+
</xi:include>
56
52

57
53
<classsynopsisinfo role="comment">&InheritedMethods;</classsynopsisinfo>
58
-
<xi:include xpointer="xmlns(db=http://docbook.org/ns/docbook) xpointer(id('class.exception')/db:refentry/db:refsect1[@role='description']/descendant::db:methodsynopsis[1])" />
54
+
<xi:include xpointer="xmlns(db=http://docbook.org/ns/docbook) xpointer(id('class.exception')/db:refentry/db:refsect1[@role='description']/descendant::db:methodsynopsis[@role='Exception'])">
55
+
<xi:fallback/>
56
+
</xi:include>
59
57
</classsynopsis>
60
58
<!-- }}} -->
61
59
...
...
@@ -83,14 +81,16 @@
83
81
<programlisting role="php">
84
82
<![CDATA[
85
83
<?php
86
-
function exception_error_handler($severity, $message, $file, $line) {
87
-
if (!(error_reporting() & $severity)) {
84
+
function exception_error_handler(int $errno, string $errstr, string $errfile = null, int $errline) {
85
+
if (!(error_reporting() & $errno)) {
88
86
// This error code is not included in error_reporting
89
87
return;
90
88
}
91
-
throw new ErrorException($message, 0, $severity, $file, $line);
89
+
throw new \ErrorException($errstr, 0, $errno, $errfile, $errline);
92
90
}
93
-
set_error_handler("exception_error_handler");
91
+
set_error_handler(exception_error_handler(...));
92
+
// Prior to PHP 8.1.0 and the introduction of the first class callable syntax, the following call must be used instead
93
+
// set_error_handler(__NAMESPACE__ . "\\exception_error_handler");
94
94

95
95
/* Trigger exception */
96
96
strpos();
...
...
@@ -118,7 +118,6 @@ Stack trace:
118
118
&language.predefined.errorexception.getseverity;
119
119
120
120
</phpdoc:exceptionref>
121
-
122
121
<!-- Keep this comment at the end of the file
123
122
Local variables:
124
123
mode: sgml
...
...
@@ -139,4 +138,3 @@ vim600: syn=xml fen fdm=syntax fdl=2 si
139
138
vim: et tw=78 syn=sgml
140
139
vi: ts=1 sw=1
141
140
-->
142
-

143
141