Created
January 28, 2016 20:39
-
-
Save mauricioprado00/b6eab7c64f763aa7e6fe to your computer and use it in GitHub Desktop.
look for magento issues with SUPEE-7405
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
<?php | |
# use like this: | |
# cd <yourmagentodir>; php -f isssues.php | |
$files = `find . -type f -iname "config.xml"`; | |
$files = explode("\n", trim($files)); | |
foreach ($files as $file) { | |
findissues($file); | |
} | |
function findissues($file) { | |
$xml = simplexml_load_file($file); | |
$events = $xml->xpath('//events'); | |
foreach ($events as $event) { | |
$observers = $event->xpath('./*'); | |
$lowerCaseNames = array(); | |
$upperCaseNames = array(); | |
foreach ($observers as $observer) { | |
$name = $observer->getName(); | |
$lname = strtolower($name); | |
if ($name !== $lname) { | |
if (isset($upperCaseNames[$name])) { | |
echo "issue1 on $file $name\n"; | |
} | |
$upperCaseNames[$name] = true; | |
} else { | |
$lowerCaseNames[$lname] = true; | |
} | |
} | |
foreach ($observers as $observer) { | |
$name = $observer->getName(); | |
$lname = strtolower($name); | |
if ($name !== $lname) { | |
if (isset($lowerCaseNames[$lname])) { | |
echo "issue2 on $file $name\n"; | |
} | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment