Permalink
Browse files

Currently there are three files in the cache directory, which don't n…

…eed to be there:

* /cache/autoloader.php
* /cache/log.php
* /cache/trace.txt

These files ship as empty place-holder files, but will be written to by the application in certain situations. This causes problems with revision control, as the files show up as 'modified' and may end up being committed to the source repository. This is not just a problem in the main ProjectPier repository, but it has down-stream implications too.

The code already creates these files automatically if they don't already exist, but there are a couple of places where errors may be raised if they are not present. This commit contains the necessary modifications to remove these errors:

* When including the autoloader.php, we suppress errors using @ prior to the fopen() statement.
* The __production_error_handler() was logging all errors (except E_STRICT), even if they were deliberately suppressed using @. This patch updates the function so that it ignores suppressed errors. I've also added a comment to explain what 2048 means, and why the E_STRICT constant isn't being used.

This has been logged as a bug at http://www.projectpier.org/node/3245.
  • Loading branch information...
1 parent f5afee0 commit 4d58a114e88786431207b9eb2d5dad44b2734e83 @MarkMaldaba MarkMaldaba committed Apr 28, 2012
@@ -301,7 +301,7 @@ function browse_log() {
$dir = isset($_GET['dir']) ? $_GET['dir'] : 'up';
$lines = array();
- $handle = fopen("cache/log.php", "r");
+ $handle = @fopen("cache/log.php", "r");
//$handle = fopen("AdministrationController.class.php", "r");
if ($handle) {
if ($pos<0) {
@@ -64,7 +64,11 @@ function __shutdown() {
*/
function __production_error_handler($code, $message, $file, $line) {
// Skip non-static method called statically type of error...
- if ($code == 2048) {
+ // 2048 = E_SRICT, but we don't use the constant as it may not be defined in the
+ // current version of PHP.
+ // We also skip errors that have been suppressed using @ (which sets
+ // error_reporting() to zero).
+ if ($code == 2048 || error_reporting() == 0) {
return;
} // if
No changes.
View
No changes.
View
No changes.

0 comments on commit 4d58a11

Please sign in to comment.