-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #155 from moufmouf/better_error_reporting
Displaying all errors even if error_reporting in poorly configured
- Loading branch information
Showing
23 changed files
with
149 additions
and
149 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,13 @@ | ||
<?php | ||
/* | ||
* This file is part of the Mouf core package. | ||
* | ||
* (c) 2012 David Negrier <[email protected]> | ||
* | ||
* For the full copyright and license information, please view the LICENSE.txt | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
/* | ||
* This file is part of the Mouf core package. | ||
* | ||
* (c) 2012 David Negrier <[email protected]> | ||
* | ||
* For the full copyright and license information, please view the LICENSE.txt | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
/** | ||
* Analyses all included PHP files to detect whether one is not behaving correctly (outputing some text, which is strictly forbidden) | ||
*/ | ||
|
@@ -19,7 +19,7 @@ | |
|
||
ini_set('display_errors', 1); | ||
// Add E_ERROR to error reporting if it is not already set | ||
error_reporting(E_ERROR | error_reporting()); | ||
error_reporting(E_ERROR | E_PARSE | E_CORE_ERROR | E_COMPILE_ERROR | E_USER_ERROR | E_RECOVERABLE_ERROR | error_reporting()); | ||
|
||
if (!isset($_REQUEST["selfedit"]) || $_REQUEST["selfedit"]!="true") { | ||
define('ROOT_URL', $_SERVER['BASE']."/../../../"); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,18 @@ | ||
<?php | ||
/* | ||
* This file is part of the Mouf core package. | ||
* | ||
* (c) 2012 David Negrier <[email protected]> | ||
* | ||
* For the full copyright and license information, please view the LICENSE.txt | ||
* file that was distributed with this source code. | ||
*/ | ||
/* | ||
* This file is part of the Mouf core package. | ||
* | ||
* (c) 2012 David Negrier <[email protected]> | ||
* | ||
* For the full copyright and license information, please view the LICENSE.txt | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
use Mouf\MoufManager; | ||
use Mouf\MoufManager; | ||
|
||
ini_set('display_errors', 1); | ||
// Add E_ERROR to error reporting it it is not already set | ||
error_reporting(E_ERROR | error_reporting()); | ||
error_reporting(E_ERROR | E_PARSE | E_CORE_ERROR | E_COMPILE_ERROR | E_USER_ERROR | E_RECOVERABLE_ERROR | error_reporting()); | ||
|
||
// This validator checks that all the config parameters defined are present in the config.php file. | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,19 @@ | ||
<?php | ||
/* | ||
* This file is part of the Mouf core package. | ||
* | ||
* (c) 2012 David Negrier <[email protected]> | ||
* | ||
* For the full copyright and license information, please view the LICENSE.txt | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
/* | ||
* This file is part of the Mouf core package. | ||
* | ||
* (c) 2012 David Negrier <[email protected]> | ||
* | ||
* For the full copyright and license information, please view the LICENSE.txt | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
|
||
use Mouf\Reflection\MoufReflectionClass; | ||
use Mouf\Reflection\MoufReflectionClass; | ||
|
||
ini_set('display_errors', 1); | ||
// Add E_ERROR to error reporting it it is not already set | ||
error_reporting(E_ERROR | error_reporting()); | ||
error_reporting(E_ERROR | E_PARSE | E_CORE_ERROR | E_COMPILE_ERROR | E_USER_ERROR | E_RECOVERABLE_ERROR | error_reporting()); | ||
|
||
if (!isset($_REQUEST["selfedit"]) || $_REQUEST["selfedit"]!="true") { | ||
define('ROOT_URL', $_SERVER['BASE']."/../../../"); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,21 @@ | ||
<?php | ||
/* | ||
* This file is part of the Mouf core package. | ||
* | ||
* (c) 2012 David Negrier <[email protected]> | ||
* | ||
* For the full copyright and license information, please view the LICENSE.txt | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
/* | ||
* This file is part of the Mouf core package. | ||
* | ||
* (c) 2012 David Negrier <[email protected]> | ||
* | ||
* For the full copyright and license information, please view the LICENSE.txt | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
/** | ||
* Returns a serialized string representing the array for all components declares (classes with the @Component annotation) | ||
*/ | ||
|
||
|
||
ini_set('display_errors', 1); | ||
// Add E_ERROR to error reporting it it is not already set | ||
error_reporting(E_ERROR | error_reporting()); | ||
error_reporting(E_ERROR | E_PARSE | E_CORE_ERROR | E_COMPILE_ERROR | E_USER_ERROR | E_RECOVERABLE_ERROR | error_reporting()); | ||
|
||
if (!isset($_REQUEST["selfedit"]) || $_REQUEST["selfedit"]!="true") { | ||
define('ROOT_URL', $_SERVER['BASE']."/../../../"); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,18 @@ | ||
<?php | ||
/* | ||
* This file is part of the Mouf core package. | ||
* | ||
* (c) 2012 David Negrier <[email protected]> | ||
* | ||
* For the full copyright and license information, please view the LICENSE.txt | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
/* | ||
* This file is part of the Mouf core package. | ||
* | ||
* (c) 2012 David Negrier <[email protected]> | ||
* | ||
* For the full copyright and license information, please view the LICENSE.txt | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
|
||
|
||
ini_set('display_errors', 1); | ||
// Add E_ERROR to error reporting it it is not already set | ||
error_reporting(E_ERROR | error_reporting()); | ||
error_reporting(E_ERROR | E_PARSE | E_CORE_ERROR | E_COMPILE_ERROR | E_USER_ERROR | E_RECOVERABLE_ERROR | error_reporting()); | ||
|
||
if (!isset($_REQUEST["selfedit"]) || $_REQUEST["selfedit"]!="true") { | ||
$fileName = dirname(__FILE__)."/../../../../../config.php"; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,26 @@ | ||
<?php | ||
/* | ||
* This file is part of the Mouf core package. | ||
* | ||
* (c) 2012 David Negrier <[email protected]> | ||
* | ||
* For the full copyright and license information, please view the LICENSE.txt | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
/* | ||
* This file is part of the Mouf core package. | ||
* | ||
* (c) 2012 David Negrier <[email protected]> | ||
* | ||
* For the full copyright and license information, please view the LICENSE.txt | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
/** | ||
* Returns a serialized string representing the array for all components declarations (classes with the @Component annotation), | ||
* along additional interesting infos (subclasses, name of the declaration file, etc...) | ||
*/ | ||
|
||
|
||
use Mouf\Moufspector; | ||
use Mouf\Moufspector; | ||
|
||
use Mouf\MoufManager; | ||
use Mouf\MoufManager; | ||
|
||
ini_set('display_errors', 1); | ||
// Add E_ERROR to error reporting it it is not already set | ||
error_reporting(E_ERROR | error_reporting()); | ||
error_reporting(E_ERROR | E_PARSE | E_CORE_ERROR | E_COMPILE_ERROR | E_USER_ERROR | E_RECOVERABLE_ERROR | error_reporting()); | ||
|
||
// Disable output buffering | ||
while (ob_get_level() != 0) { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,13 @@ | ||
<?php | ||
/* | ||
* This file is part of the Mouf core package. | ||
* | ||
* (c) 2012 David Negrier <[email protected]> | ||
* | ||
* For the full copyright and license information, please view the LICENSE.txt | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
/* | ||
* This file is part of the Mouf core package. | ||
* | ||
* (c) 2012 David Negrier <[email protected]> | ||
* | ||
* For the full copyright and license information, please view the LICENSE.txt | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
use Mouf\MoufManager; | ||
|
||
/** | ||
|
@@ -17,7 +17,7 @@ | |
|
||
ini_set('display_errors', 1); | ||
// Add E_ERROR to error reporting it it is not already set | ||
error_reporting(E_ERROR | error_reporting()); | ||
error_reporting(E_ERROR | E_PARSE | E_CORE_ERROR | E_COMPILE_ERROR | E_USER_ERROR | E_RECOVERABLE_ERROR | error_reporting()); | ||
|
||
if (!isset($_REQUEST["selfedit"]) || $_REQUEST["selfedit"]!="true") { | ||
define('ROOT_URL', $_SERVER['BASE']."/../../../"); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,27 @@ | ||
<?php | ||
/* | ||
* This file is part of the Mouf core package. | ||
* | ||
* (c) 2012 David Negrier <[email protected]> | ||
* | ||
* For the full copyright and license information, please view the LICENSE.txt | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
/* | ||
* This file is part of the Mouf core package. | ||
* | ||
* (c) 2012 David Negrier <[email protected]> | ||
* | ||
* For the full copyright and license information, please view the LICENSE.txt | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
/** | ||
* Returns a serialized string representing the array for all components declares (classes with the @Component annotation) | ||
*/ | ||
|
||
|
||
use Mouf\Reflection\MoufReflectionClass; | ||
use Mouf\Reflection\MoufReflectionClass; | ||
|
||
use Mouf\Moufspector; | ||
use Mouf\Moufspector; | ||
|
||
use Mouf\MoufManager; | ||
use Mouf\MoufManager; | ||
|
||
ini_set('display_errors', 1); | ||
// Add E_ERROR to error reporting it it is not already set | ||
error_reporting(E_ERROR | error_reporting()); | ||
error_reporting(E_ERROR | E_PARSE | E_CORE_ERROR | E_COMPILE_ERROR | E_USER_ERROR | E_RECOVERABLE_ERROR | error_reporting()); | ||
|
||
if (!isset($_REQUEST["selfedit"]) || $_REQUEST["selfedit"]!="true") { | ||
define('ROOT_URL', $_SERVER['BASE']."/../../../"); | ||
|
@@ -115,32 +115,32 @@ | |
} | ||
|
||
function checkJsonEncode($array) { | ||
foreach($array as $key =>$value) { | ||
json_encode($value); | ||
|
||
if (!(json_last_error() == JSON_ERROR_NONE)) { | ||
switch (json_last_error()) { | ||
case JSON_ERROR_DEPTH: | ||
echo $key.' - Maximum stack depth exceeded'; | ||
break; | ||
case JSON_ERROR_STATE_MISMATCH: | ||
echo $key.' - Underflow or the modes mismatch'; | ||
break; | ||
case JSON_ERROR_CTRL_CHAR: | ||
echo $key.' - Unexpected control character found'; | ||
break; | ||
case JSON_ERROR_SYNTAX: | ||
echo $key.' - Syntax error, malformed JSON'; | ||
break; | ||
case JSON_ERROR_UTF8: | ||
echo $key.' - Malformed UTF-8 characters, possibly incorrectly encoded'; | ||
|
||
break; | ||
default: | ||
echo $key.' - Unknown error'; | ||
break; | ||
} | ||
} | ||
foreach($array as $key =>$value) { | ||
json_encode($value); | ||
|
||
if (!(json_last_error() == JSON_ERROR_NONE)) { | ||
switch (json_last_error()) { | ||
case JSON_ERROR_DEPTH: | ||
echo $key.' - Maximum stack depth exceeded'; | ||
break; | ||
case JSON_ERROR_STATE_MISMATCH: | ||
echo $key.' - Underflow or the modes mismatch'; | ||
break; | ||
case JSON_ERROR_CTRL_CHAR: | ||
echo $key.' - Unexpected control character found'; | ||
break; | ||
case JSON_ERROR_SYNTAX: | ||
echo $key.' - Syntax error, malformed JSON'; | ||
break; | ||
case JSON_ERROR_UTF8: | ||
echo $key.' - Malformed UTF-8 characters, possibly incorrectly encoded'; | ||
|
||
break; | ||
default: | ||
echo $key.' - Unknown error'; | ||
break; | ||
} | ||
} | ||
} | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,18 @@ | ||
<?php | ||
/* | ||
* This file is part of the Mouf core package. | ||
* | ||
* (c) 2012 David Negrier <[email protected]> | ||
* | ||
* For the full copyright and license information, please view the LICENSE.txt | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
/* | ||
* This file is part of the Mouf core package. | ||
* | ||
* (c) 2012 David Negrier <[email protected]> | ||
* | ||
* For the full copyright and license information, please view the LICENSE.txt | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
|
||
|
||
ini_set('display_errors', 1); | ||
// Add E_ERROR to error reporting it it is not already set | ||
error_reporting(E_ERROR | error_reporting()); | ||
error_reporting(E_ERROR | E_PARSE | E_CORE_ERROR | E_COMPILE_ERROR | E_USER_ERROR | E_RECOVERABLE_ERROR | error_reporting()); | ||
|
||
require_once '../../Mouf.php'; | ||
require_once '../Moufspector.php'; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.