The Artima Developer Community
Sponsored Link

PHP Buzz Forum
Fatal Error is the Fatal Error of PHP - How to avoid it

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Pure-PHP

Posts: 20
Nickname: purephp
Registered: Mar, 2005

Pure-PHP is kind of Blog about PHP, and unconventional methodes to boost PHP-apps
Fatal Error is the Fatal Error of PHP - How to avoid it Posted: Mar 23, 2005 4:59 AM
Reply to this message Reply

This post originated from an RSS feed registered with PHP Buzz by Pure-PHP.
Original Post: Fatal Error is the Fatal Error of PHP - How to avoid it
Feed Title: Pure PHP - PHP unconventional
Feed URL: http://www.iran-fun.com/
Feed Description: Unconventional methodes to boost php apps
Latest PHP Buzz Posts
Latest PHP Buzz Posts by Pure-PHP
Latest Posts From Pure PHP - PHP unconventional

Advertisement

One of the disadvantages of PHP, and one of the things I don't like about the php, is the fatal error, beacsue there isn't any way to avoid it. Well PHP is actually thought to be used in web environment, therefor it is not so imortant, if your script causes a fatal error, then only the execution of the script for a single request would be terminated.

In PHP commandline apps, it is really fatal, if your app causes a fatal error, beacuse you have to restart your app. Well you can avoid this, if you write your app very carefully. You should always use if(function_exists("a_func")) and if(methode_exists("a_methode")). Now you can be pretty sure, that the script won't cause any fatal error.
If you dynamically load third party modules in your app, you have a real problem, because the included module could cause a fatal error, yor app would be terminated. There is on way to avoid it. Use call_user_func. You can replace in third party modules every function call and metode call with call_user_func. For exmpale.

<?php

function add($a,$b){
echo
$a+$b;
}
// call the function with a small mistake
ad(2,3); // causes a fatal error
//replace it with
call_user_func("ad",2,3); // causes a warning

?>

Read: Fatal Error is the Fatal Error of PHP - How to avoid it

Topic: Apache-Test and SimpleTest Previous Topic   Next Topic Topic: WordPress 1.5 Hack: How to trim the fat resource hogging Admin DashBoard

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use