Skip to content

Commit

Permalink
Merge pull request #155 from moufmouf/better_error_reporting
Browse files Browse the repository at this point in the history
Displaying all errors even if error_reporting in poorly configured
  • Loading branch information
moufmouf authored Nov 22, 2018
2 parents a04769f + 865f7d4 commit 965154e
Show file tree
Hide file tree
Showing 23 changed files with 149 additions and 149 deletions.
20 changes: 10 additions & 10 deletions src/direct/analyze_includes.php
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 <david@mouf-php.com>
*
* 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 <david@mouf-php.com>
*
* 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)
*/
Expand All @@ -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']."/../../../");
Expand Down
2 changes: 1 addition & 1 deletion src/direct/analyze_includes_2.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,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']."/../../../");
Expand Down
20 changes: 10 additions & 10 deletions src/direct/config_complete_validator.php
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 <david@mouf-php.com>
*
* 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 <david@mouf-php.com>
*
* 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.

Expand Down
2 changes: 1 addition & 1 deletion src/direct/get_all_classes.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,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']."/../../../");
Expand Down
22 changes: 11 additions & 11 deletions src/direct/get_class.php
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 <david@mouf-php.com>
*
* 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 <david@mouf-php.com>
*
* 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']."/../../../");
Expand Down
2 changes: 1 addition & 1 deletion src/direct/get_class_map.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,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']."/../../../");
Expand Down
20 changes: 10 additions & 10 deletions src/direct/get_components_list.php
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 <david@mouf-php.com>
*
* 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 <david@mouf-php.com>
*
* 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']."/../../../");
Expand Down
20 changes: 10 additions & 10 deletions src/direct/get_defined_constants.php
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 <david@mouf-php.com>
*
* 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 <david@mouf-php.com>
*
* 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";
Expand Down
24 changes: 12 additions & 12 deletions src/direct/get_enhanced_components_list.php
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 <david@mouf-php.com>
*
* 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 <david@mouf-php.com>
*
* 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) {
Expand Down
2 changes: 1 addition & 1 deletion src/direct/get_instance_details.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,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']."/../../../");
Expand Down
20 changes: 10 additions & 10 deletions src/direct/get_instances.php
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 <david@mouf-php.com>
*
* 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 <david@mouf-php.com>
*
* For the full copyright and license information, please view the LICENSE.txt
* file that was distributed with this source code.
*/

use Mouf\MoufManager;

/**
Expand All @@ -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']."/../../../");
Expand Down
78 changes: 39 additions & 39 deletions src/direct/get_instances_with_details.php
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 <david@mouf-php.com>
*
* 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 <david@mouf-php.com>
*
* 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']."/../../../");
Expand Down Expand Up @@ -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;
}
}
}
}

Expand Down
20 changes: 10 additions & 10 deletions src/direct/get_properties_for_class.php
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 <david@mouf-php.com>
*
* 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 <david@mouf-php.com>
*
* 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';
Expand Down
2 changes: 1 addition & 1 deletion src/direct/get_source_file.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,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']."/../../../");
Expand Down
Loading

0 comments on commit 965154e

Please sign in to comment.