Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
MPERF-10565.diff - logging to a file that does not exist issue
diff --git a/app/Mage.php b/app/Mage.php
index 0e650eebb4f..9c18e222689 100644
--- a/app/Mage.php
+++ b/app/Mage.php
@@ -798,9 +798,9 @@ public static function log($message, $level = null, $file = '', $forceLog = fals
',',
(string) self::getConfig()->getNode('dev/log/allowedFileExtensions', Mage_Core_Model_Store::DEFAULT_CODE)
);
- $logValidator = new Zend_Validate_File_Extension($_allowedFileExtensions);
$logDir = self::getBaseDir('var') . DS . 'log';
- if (!$logValidator->isValid($logDir . DS . $file)) {
+ $validatedFileExtension = pathinfo($file, PATHINFO_EXTENSION);
+ if (!$validatedFileExtension || !in_array($validatedFileExtension, $_allowedFileExtensions)) {
return;
}
@mehdichaouch

This comment has been minimized.

Copy link

mehdichaouch commented Sep 24, 2019

I suggest to do not change core code and use an update like this (https://gist.github.com/mehdichaouch/99c67298b5a65f81219c9b69942b6fe7)

$installer->run("
    INSERT INTO `{$installer->getTable('core_config_data')}` (scope, scope_id, path, value)
    VALUES ('default', 0, 'dev/log/allowedFileExtensions', 'log,txt,html,csv')
    ON DUPLICATE KEY UPDATE value = 'log,txt,html,csv';
");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.