com presentations: Engine exceptions: slides/intro/php7_2 015.xml
[email protected] (Rasmus Lerdorf)
| Newsgroups | php.pres |
|---|---|
| Message-ID | <[email protected]> |
Commit: 6dbf1d517fa11a05f75f5655225e278d93918c56 Author: Rasmus Lerdorf <[email protected]> Sun, 8 Mar 2015 11:38:31 -0700 Parents: 5948cbf89d80c607995d3fb33a4ecf79aa9aa3ab Branches: master Link: http://git.php.net/?p=presentations.git;a=commitdiff;h=6dbf1d517fa11a05f75f5655225e278d93918c56 Log: Engine exceptions Changed paths: M slides/intro/php7_2015.xml Diff: diff --git a/slides/intro/php7_2015.xml b/slides/intro/php7_2015.xml index 223d9ac..733e05d 100644 --- a/slides/intro/php7_2015.xml +++ b/slides/intro/php7_2015.xml @@ -36,6 +36,28 @@ echo $a ?? $b ?? $c; // 1 echo $a ?? $x ?? $c; // 2 ]]></example> +<break lines="1" section="php7excep"/> +<blurb fontsize="1.1em" align="left">✔ Exceptions on Fatals</blurb> +<example fontsize="1.5em" result='0' title=""><![CDATA[ +<?php +function call_method($obj) { + $obj->method(); +} + +call_method(null); +// Fatal error: Call to a member function method() on a non-object +]]></example> + +<example fontsize="1.5em" result='0' title=""><![CDATA[ +<?php +try { + call_method(null); +} catch (EngineException $e) { + echo "Exception: {$e->getMessage()}\n"; +} +// Exception: Call to a member function method() on a non-object +]]></example> + <break lines="1" section="php7cleanups"/> <blurb fontsize="1.1em" align="left">✔ Removal of many deprecated featuresBR/ (Your PHP4 code will break!)</blurb>