SUPEE-10415 Known issue

Issue: Magento 1.9.x displays a “404: Page Not Found” error from the errors/ directory after upgrading to SUPEE-10415. This issue occurs only in Magento installations that run certain third-party extensions. Magento 1.9.3.6 and later with SUPEE-10415 contain a potentially serious bug. Under certain conditions, every product page on your site will get 404 error sometimes.

Description: Magento is not properly logging PHP warnings that occur early during page initialization. Instead, of logging the error and continuing operation, Magento generates a 404 page. (Previously, Magento logged these warnings in the system.log file, and execution would continue as usual.)

Workaround: Confirm that there are no PHP warnings generated by any of the extensions or customizations.

http://devdocs.magento.com/guides/m1x/ce19-ee114/ce1.9_release-notes.html#ce19-1936

How To Actually Fix The Issue

The workaround documented by Magento Team is less than ideal. Calls to Mage::log() prior to store instantiation originate from 3rd party extensions and modifying these is against best practice.

Instead, isLogFileExtensionValid() should simply become an internal method to the Mage class. This would prevent instantiating an instance of Mage_Log_Helper_Data, which is the the the first domino eventually leading to the 404s.

Make isLogFileExtensionValid a method of the Mage class and then call it through `self::` instead of through `self::helper('log')`. You need to add the following php codes in app/Mage.php:

// bof 1 of 2 by vito
private $_allowedFileExtensions = array('log', 'txt', 'html', 'csv');

public static function isLogFileExtensionValid($file)
{
$result = false;
$validatedFileExtension = pathinfo($file, PATHINFO_EXTENSION);
if ($validatedFileExtension && in_array($validatedFileExtension, $this->_allowedFileExtensions)) {
$result = true;
}
return $result;
}
// eof 1 of 2 by vito

Then in app/Mage.php, you’d call `isLogFileExtensionValid` through `self::`, find the below code:

// bof 2 of 2 by vito

if (!self::helper('log')->isLogFileExtensionValid($file)) {
return;
}

**replace it to below codes**

if (!self::isLogFileExtensionValid($file)) {
return;
}

// eof 2 of 2 by vito

https://maxchadwick.xyz/blog/supee-10415-causing-every-page-to-404

Note: my magento edition is magento 1.9.3.6, and I cannot find self::helper(‘log’) in app/Mage.php… So this mean the 404 error not cased by SUPEE-10415. If your problems like me. Go ahead to read below content:

How to find which issue cased the 404 error on product pages?

Check your error_log file under magento root directory. My error is below: SOAP-ERROR: Parsing WSDL: Couldn’t load from … : failed to load external entity …

SOAP-ERROR: Parsing WSDL: Couldn't load from 'http://mydomain.com/api/soap/?wsdl=1' : failed to load external entity "http://mydomain.com/api/soap/?wsdl=1"

Because I am using Trustpilot’s Magento Application on my site: key1024.com, which using Magento SOAP API. So I found the issue is SOAP cannot call WSDL correctly…

First, I opened the URL ‘http://mydomain.com/api/soap/?wsdl=1’ directlty in my web browser, it displayed the wsdl file as expected (no error).

The cause of the error is: PHP SoapServer needs to read the wsdl to know which methods are exposed, but when it tries to access the wsdl using mydomain.com instead of localhost it is not able to do so. So, its some network configuration error.

To confirm the same, connect to your server via SSH and try running the following:

curl http://mydomain.com/api/soap/?wsdl=1

If the above command does not display the wsdl file but gives some error then its a network configuration error. I was using a Unix/Linux Centos 6/7 server and my problem was solved by adding an entry for the domain in the ‘hosts’ file ‘/etc/hosts’ as follows:

  1. Log in to your server as the root user via SSH.
  2. Open the /etc/hosts file with a text editor. For example: sudo nano /etc/hosts
  3. Add the destination server’s IP address and domain name under the latest entry in the file, for example: 1.2.3.4 example.com www.example.com

In my case my magento application was on the same server on which I was using the Magento API. If your Magento code is on one server and you are trying to call the Magneto API from another server then you can check your firewall rules.

http://www.techawaken.com/soap-error-parsing-wsdl-load-failed-load-external-entity/

Leave a Reply