🌌 SpectraShell

🌌 SpectraShell

Current path: home/a1642gum/public_html/wp-includes/



⬆️ Go up: public_html

📄 Viewing: class-wp-fatal-error-handler.php

<?php
/**
 * Error Protection API: WP_Fatal_Error_Handler class
 *
 * @package WordPress
 * @since 5.2.0
 */

/**
 * Core class used as the default shutdown handler for fatal errors.
 *
 * A drop-in 'fatal-error-handler.php' can be used to override the instance of this class and use a custom
 * implementation for the fatal error handler that WordPress registers. The custom class should extend this class and
 * can override its methods individually as necessary. The file must return the instance of the class that should be
 * registered.
 *
 * @since 5.2.0
 */
#[AllowDynamicProperties]
class WP_Fatal_Error_Handler {

	/**
	 * Runs the shutdown handler.
	 *
	 * This method is registered via `register_shutdown_function()`.
	 *
	 * @since 5.2.0
	 *
	 * @global WP_Locale $wp_locale WordPress date and time locale object.
	 */
	public function handle() {
		if ( defined( 'WP_SANDBOX_SCRAPING' ) && WP_SANDBOX_SCRAPING ) {
			return;
		}

		// Do not trigger the fatal error handler while updates are being installed.
		if ( wp_is_maintenance_mode() ) {
			return;
		}

		try {
			// Bail if no error found.
			$error = $this->detect_error();
			if ( ! $error ) {
				return;
			}

			if ( ! isset( $GLOBALS['wp_locale'] ) && function_exists( 'load_default_textdomain' ) ) {
				load_default_textdomain();
			}

			$handled = false;

			if ( ! is_multisite() && wp_recovery_mode()->is_initialized() ) {
				$handled = wp_recovery_mode()->handle_error( $error );
			}

			// Display the PHP error template if headers not sent.
			if ( is_admin() || ! headers_sent() ) {
				$this->display_error_template( $error, $handled );
			}
		} catch ( Exception $e ) {
			// Catch exceptions and remain silent.
		}
	}

	/**
	 * Detects the error causing the crash if it should be handled.
	 *
	 * @since 5.2.0
	 *
	 * @return array|null Error information returned by `error_get_last()`, or null
	 *                    if none was recorded or the error should not be handled.
	 */
	protected function detect_error() {
		$error = error_get_last();

		// No error, just skip the error handling code.
		if ( null === $error ) {
			return null;
		}

		// Bail if this error should not be handled.
		if ( ! $this->should_handle_error( $error ) ) {
			return null;
		}

		return $error;
	}

	/**
	 * Determines whether we are dealing with an error that WordPress should handle
	 * in order to protect the admin backend against WSODs.
	 *
	 * @since 5.2.0
	 *
	 * @param array $error Error information retrieved from `error_get_last()`.
	 * @return bool Whether WordPress should handle this error.
	 */
	protected function should_handle_error( $error ) {
		$error_types_to_handle = array(
			E_ERROR,
			E_PARSE,
			E_USER_ERROR,
			E_COMPILE_ERROR,
			E_RECOVERABLE_ERROR,
		);

		if ( isset( $error['type'] ) && in_array( $error['type'], $error_types_to_handle, true ) ) {
			return true;
		}

		/**
		 * Filters whether a given thrown error should be handled by the fatal error handler.
		 *
		 * This filter is only fired if the error is not already configured to be handled by WordPress core. As such,
		 * it exclusively allows adding further rules for which errors should be handled, but not removing existing
		 * ones.
		 *
		 * @since 5.2.0
		 *
		 * @param bool  $should_handle_error Whether the error should be handled by the fatal error handler.
		 * @param array $error               Error information retrieved from `error_get_last()`.
		 */
		return (bool) apply_filters( 'wp_should_handle_php_error', false, $error );
	}

	/**
	 * Displays the PHP error template and sends the HTTP status code, typically 500.
	 *
	 * A drop-in 'php-error.php' can be used as a custom template. This drop-in should control the HTTP status code and
	 * print the HTML markup indicating that a PHP error occurred. Note that this drop-in may potentially be executed
	 * very early in the WordPress bootstrap process, so any core functions used that are not part of
	 * `wp-includes/load.php` should be checked for before being called.
	 *
	 * If no such drop-in is available, this will call {@see WP_Fatal_Error_Handler::display_default_error_template()}.
	 *
	 * @since 5.2.0
	 * @since 5.3.0 The `$handled` parameter was added.
	 *
	 * @param array         $error   Error information retrieved from `error_get_last()`.
	 * @param true|WP_Error $handled Whether Recovery Mode handled the fatal error.
	 */
	protected function display_error_template( $error, $handled ) {
		if ( defined( 'WP_CONTENT_DIR' ) ) {
			// Load custom PHP error template, if present.
			$php_error_pluggable = WP_CONTENT_DIR . '/php-error.php';
			if ( is_readable( $php_error_pluggable ) ) {
				require_once $php_error_pluggable;

				return;
			}
		}

		// Otherwise, display the default error template.
		$this->display_default_error_template( $error, $handled );
	}

	/**
	 * Displays the default PHP error template.
	 *
	 * This method is called conditionally if no 'php-error.php' drop-in is available.
	 *
	 * It calls {@see wp_die()} with a message indicating that the site is experiencing technical difficulties and a
	 * login link to the admin backend. The {@see 'wp_php_error_message'} and {@see 'wp_php_error_args'} filters can
	 * be used to modify these parameters.
	 *
	 * @since 5.2.0
	 * @since 5.3.0 The `$handled` parameter was added.
	 *
	 * @param array         $error   Error information retrieved from `error_get_last()`.
	 * @param true|WP_Error $handled Whether Recovery Mode handled the fatal error.
	 */
	protected function display_default_error_template( $error, $handled ) {
		if ( ! function_exists( '__' ) ) {
			wp_load_translations_early();
		}

		if ( ! function_exists( 'wp_die' ) ) {
			require_once ABSPATH . WPINC . '/functions.php';
		}

		if ( ! class_exists( 'WP_Error' ) ) {
			require_once ABSPATH . WPINC . '/class-wp-error.php';
		}

		if ( true === $handled && wp_is_recovery_mode() ) {
			$message = __( 'There has been a critical error on this website, putting it in recovery mode. Please check the Themes and Plugins screens for more details. If you just installed or updated a theme or plugin, check the relevant page for that first.' );
		} elseif ( is_protected_endpoint() && wp_recovery_mode()->is_initialized() ) {
			if ( is_multisite() ) {
				$message = __( 'There has been a critical error on this website. Please reach out to your site administrator, and inform them of this error for further assistance.' );
			} else {
				$message = sprintf(
					/* translators: %s: Support forums URL. */
					__( 'There has been a critical error on this website. Please check your site admin email inbox for instructions. If you continue to have problems, please try the <a href="%s">support forums</a>.' ),
					__( 'https://wordpress.org/support/forums/' )
				);
			}
		} else {
			$message = __( 'There has been a critical error on this website.' );
		}

		$message = sprintf(
			'<p>%s</p><p><a href="%s">%s</a></p>',
			$message,
			/* translators: Documentation about troubleshooting. */
			__( 'https://wordpress.org/documentation/article/faq-troubleshooting/' ),
			__( 'Learn more about troubleshooting WordPress.' )
		);

		$args = array(
			'response' => 500,
			'exit'     => false,
		);

		/**
		 * Filters the message that the default PHP error template displays.
		 *
		 * @since 5.2.0
		 *
		 * @param string $message HTML error message to display.
		 * @param array  $error   Error information retrieved from `error_get_last()`.
		 */
		$message = apply_filters( 'wp_php_error_message', $message, $error );

		/**
		 * Filters the arguments passed to {@see wp_die()} for the default PHP error template.
		 *
		 * @since 5.2.0
		 *
		 * @param array $args Associative array of arguments passed to `wp_die()`. By default these contain a
		 *                    'response' key, and optionally 'link_url' and 'link_text' keys.
		 * @param array $error Error information retrieved from `error_get_last()`.
		 */
		$args = apply_filters( 'wp_php_error_args', $args, $error );

		$wp_error = new WP_Error(
			'internal_server_error',
			$message,
			array(
				'error' => $error,
			)
		);

		wp_die( $wp_error, '', $args );
	}
}



📁

Why Autism Will Never Interfere with Our Happiness

Here we are with another inspiring story about how a family beat the odds (and stereotype) of autism and emerged victorious. Through this series of Autism Success Stories, we want to celebrate the developments and achievements of our young stars and their families, and through them, want to let you know that there is always hope and support for you (as a parent and a professional).

 

This month, we feature 20-year-old Vishal Srinivas, and his parents – Viji and Srinivas. Srinivas works for a multinational corporation and Viji has been a teacher at SAI for 7 years. Vishal was a student at SAI for the duration too. Here is Viji sharing her’s and Vishal’s remarkable story of improvement and happiness.

 

On September 5th, 2000, I took Vishal for his first session with a Speech Language Pathologist (SLP) at Anushakti Nagar, Chembur. As soon as we stepped out of the building after the session, Vishal freed himself from my hold and took off like a bullet. He kept running (on the footpath, thankfully) and didn’t turn back even once. It was a new place and I was terrified. While chasing him, I kept thinking, “God, where am I? What is happening? How will I get through this?”

 

Fast forward to September 5th, 2015, and Vishal stepped out of home with his father to go to the bank. We have a ritual: whenever a person leaves from home, someone from the family stands in the balcony and waves. If I leave, my mother-in-law stands in the balcony. That day, Vishal took his long, self-assured strides (he’s 6’ 2”), stopped, turned around to look at the balcony and waved “Bye ma! Bye patima (grandma)!” It’s a norm for him to wave out to us in the balcony now. Then he takes his long strides, reaches the end of the road and waits for the person accompanying him to catch up – whether his dad or me. My son has come such a long way.

 

Vishal was initially admitted to Sevadaan Special School in Chembur. He was placed in the group of most heavily affected children (probably because the staff found it hard to handle children with autism). I was in awe of children there who were adept at cooking and were paid for it. Today, my son, the masterchef, strides into our kitchen like a lion strides into his territory and takes charge. He inspects what is being cooked, stirs simmering dishes and is keen on helping. It’s like he’s the supervisor and I’m the assistant. Not without good reason. He is immensely fond of cooking – in fact, it’s his passion. The other day, he was preparing his favorite potato sabzi and it turned out spicy. I told him so. Rather than getting anxious, he calmly added more tomatoes to reduce the spiciness. He has remarkable acumen when it comes to altering the taste of dishes, whether they have to be sweetened or spiced up. And when I tell him to turn off the gas or add salt to a dish, I am confident that he will do it. No need for me to double check. All this from a boy who could not sit in one place due to hyperactivity.

How my son conquered autism

Vishal is sensitive to sound. When he was about 8 years old, he would bang his head hard against my arm whenever he heard a loud honk. It would hurt. But with time, he has learned to put his long fingers into his ears and partly insulate himself against loud noises. I laugh to myself when teenagers passing by wonder aloud which device to talk to someone or listen to music is so small that it is not visible… During the initial years, I simply took him along (more out of compulsion) and hoped that he would take care of himself in public. But after I joined the family consultation program, I started giving him responsibilities during our monthly provision shopping. And he loved it. Now I tell him what he has to buy orally (he’s an auditory learner) and simply have to linger around. He thinks and buys what he has been entrusted with. And once we check out, bags containing the items he has bought are his responsibility.

 

It’s age appropriate too. How many neuro-typical 20-year-olds help their parents? In fact, parents have to be more careful with 20-year-olds today. Who are they hanging out with? Are they doing something wrong? Are they lying? Not with Vishal, or any other child with autism, I believe. Living with someone with autism is a totally different experience. Our kids are loving, helpful and honest. If Vishal opens the fridge and eats a chocolate (which he rarely does, because he knows he has to follow a strict diet), he promptly walks up to me and says “I ate a chocolate.” My son’s honesty and love are reassuring.

 

Living with someone with autism can be both frustrating and gratifying. Vishal’s OCD can cause both these emotions in me. Frustration, well, if you know someone with OCD, you know what I mean. Gratifying, because once he returns home from somewhere, he puts his footwear in place, changes his clothes, washes his hands and feet and only then gets on the bed. His and my awareness and understanding have increased each day after I joined the family consultation program. I have stopped giving instructions to Vishal – it has been two years now – and the relation between him and me has blossomed. I have gained immense confidence in understanding my child, and this has helped me address and reduce one of his biggest challenges – his anxiety.

 

I want to share an incident with you. Vishal’s anxiety had reached disturbing levels in 2010. He would indulge in self-injurious behavior often. Years of purely following instructions can do that to you. He would use self-injurious behavior as a means of communication whenever he was anxious, not just on himself, but on others too. He would pull or push anyone close by, and this was impeding all his progress. It made many people around him anxious too (including yours truly). But a few weeks ago, something different occurred. We have a yoga instructor who comes home and helps Vishal do yoga for an hour (Vishal suffers from asthma. So though he loves the outdoors, he can’t spend much time there). During yoga, Vishal sweats profusely, like the cricketers we see on TV. During one session, he was tired and said something to the instructor. The instructor assumed that he had spoken in Tamil and said “Say it in English.” That was where Vishal had a bout of anxiety. Two years ago, at such times, he would have started hitting himself after saying “Adchiko” – a warning that he was about to cause harm. But today, he sat on the sofa and within a few seconds I was there. “What happened Vishal?”, I asked. The look on his face gave me the feeling that every parent yearns for. He looked at me through eyes with tears almost ready to roll out of them, as if saying “Thank God you are here! I am in so much trouble!” He told me what was troubling him and himself said “No adchiko.” Vishal feels reassured in my presence now. He knows that I am there for him and looks up to me. We share many beautiful moments together. These wonderful improvements in his life are not only because of his effort – they have come because I have worked hard on myself too. The family consultation program has taught me to stay calm when Vishal feels anxious. That gave me the confidence to take care of him which, in turn, gave him the reassurance that he could rely on me for anything. He and I trust each other implicitly now.

my son has conquered autism and does not let it come in his way of enjoying life

I could go on and on… about his love for music from Jagjit Singh to Honey Singh, about how he interacts with my relatives like a mature individual, how he likes to join conversations, how responsibly he conducted himself during the last rites of my grandmother, how he smiled when my relative’s 5-year-old daughter kept harrowing him to speak to her… and on and on… about how impressed people who interact with him are, how he thoroughly enjoyed himself sitting with folded legs on the floor and eating from a banana leaf during a family function. It’s wonderful to see the once hyperactive boy riddled with anxiety now conduct himself with such dignity in public, and become the master chef of my kitchen, and our lives.

 

I believe that we cannot expect professionals ‘cure our children’ magically. Whether a child with autism, or a neuro-typical one, we parents have to spend time with them and help them develop. Not just spend time, we have to encourage them to think for themselves, and treat them with dignity and respect – like grown-ups. This is the biggest lesson that I have learned from Mrs. Kamini Lakhani and my son. I have met many professionals who are also parents of children on the spectrum. But I have never seen anyone give as much respect and build a bond with the children like Mrs. Lakhani. Through our interactions which have spanned more than 7 years, I have learned to respect my son and treat him with dignity, and to expect others to do the same for Vishal and all other children on the autism spectrum.

 

Kamini Lakhani’s thoughts:

 

It is truly heartening to read this wonderful account about Vishal’s emergence. I am privileged to witness this emergence from close quarters.

 

In the past, I have watched the agonizing effects of his anxiety, on himself and others around him. Today, this self assured, competent young man, brings joy to my heart, as he strides through life. What I see today is a beautiful, meaningful relationship between mother and son. A relationship that is based on trust. Hats off to Viji’s hard work and diligence.

 

I look forward with hope, for Vishal to find his place in the sun.

 

If you are the parent or guardian of someone with autism or a learning disability, your family can achieve these remarkable results too. Our parent training program will offer you all the support and guidance that you need for these landmark improvements.

  •  
    1
    Share
  •  
  •  
  •  
  •  
  • 1
  •  

Kamini Lakhani

Kamini Lakhani is the founder and director of SAI Connections. She has been providing services in the field of autism for more than 25 years and is the authorized director of Professional Training for RDI in India and the Middle East. She is also the mother of a young adult with autism.

25 COMMENTS

Leave a Reply

Your email address will not be published. Required fields are marked *