Skip to content

Instantly share code, notes, and snippets.

@mauricioprado00
Created January 28, 2016 20:39
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mauricioprado00/b6eab7c64f763aa7e6fe to your computer and use it in GitHub Desktop.
Save mauricioprado00/b6eab7c64f763aa7e6fe to your computer and use it in GitHub Desktop.
look for magento issues with SUPEE-7405
<?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