Ayush
Ayush

Reputation: 42450

PHP die throwing different error message than I want it to

I have a Javascript function which calls a PHP script on my server. In case of failures, the JS function is expecting to receive a message of save_failed from the script.

For testing purposes, I put the wrong database info in the line below so that it fails:

mysql_connect("hostname", "user", "pass") or die('save_failed');

However, the JS function was not behaving as expected, and it seemed it wasn't receiving save_failed as the output. To confirm, I displayed the message being received as an alert box and this is what I got.

Why is the php script not throwing just save_failed and how can I make it do that?

JS function received msg

Upvotes: 0

Views: 108

Answers (1)

alex
alex

Reputation: 490557

You have Xdebug installed and further errors are occurring.

In production, you should have error_reporting(0) and ini_set('display_errors', '0').

Upvotes: 4

Related Questions