How to Catch a PHP Fatal ('E_Error') Error

Wordpress PHP Fatal error: Unparenthesized `a ? b : c ? d : e` is not supported. Use either `(a ? b : c)

You can try:

$taxonomy = get_the_terms($post->ID, (is_singular('post') ? 'category' : (is_singular('blog') ? 'category' : (is_singular('event') ? 'category' : 'vacancy_category'))))

However even though this doesn't ocupy too much space, I feel like it's hard to read. You could use an if else instead to make it more readable.

How to minimize PHP path cannot be found fatal error?

You'll see this error when you haven't provided a value for the GET parameter fname (i.e., included ?fname='file.txt' or similar at the end of your URL.)

You should guard against this fatal error by only executing your PHP code when $_GET['fname'] is set, using the aptly-named isset():

<?php
$fname = $_GET['fname'];
$menu = $_GET['menu'];
if (isset($_GET['fname'])) {
$fp = fopen($fname,"r") or die("File Not Found!!");
// rest of your code...
}
?>

How to manipulate the database after a fatal error in CodeIgniter?

As the user @DFriend stated in this question:

Extending CI_Log is not going to work if you need to access other
libraries. The reason is CI_Log is created long before $CI is created
so no "instance" is available for &get_instance() to return.

$this->load doesn't work because $this is not a controller ($this and
$CI point to the same object) and the class load ('CI_Loader') hasn't
been created yet either.

The way I was proceeding doesn't look like the way to go. Since extending the CI_Log class has clear limitations as the modification of the core class itself.

For the moment and since it is a temporal modification I will proceed overriding the CI_Log class and using plain PHP to complete the task.



Related Topics



Leave a reply



Submit