Magento now includes CSRF (Cross-Site Request Forgery) protection on publicly available forms such as the new user registration form. The goal of this is to make it impossible for anyone to POST to an URL without first visiting the corresponding form page. A token is supplied on this page that is sent along with the rest of the form to the server. The server validates the correctness of the token and responds in a sensible way if the token is correct. If the token is not however, the server ignores the POST request.
This problem arose after upgrading to Magento 126.96.36.199. which is a patch release that patches a number of security flaws in Magento. After installation of the patch some parts of the front-end template stayed blank. Review of the exception.log file shows a number of exceptions that seem to occur from the template filter classes of Magento.
The error is:
exception 'Exception' with message 'Notice: Undefined variable: block in /data/web/public/app/code/core/Mage/Core/Model/Email/Template/Filter.php on line 187' in /data/web/public/app/code/core/Mage/Core/functions.php:245
The layout of Magento’s information, warning and error messages cannot be easily changed using layout and template files. The HTML generation is done from a Block PHP class (Mage_Core_Block_Messages). It is a very bad idea to overwrite any core element of Magento. Instead we are going to extend this core-block by creating a separate module.
My goal was to make the messages compliant with Twitter Bootstrap alerts but the following technique can be used for about anything.
Lately I was in need for an authentication driver that supports RADIUS servers. Happily the Kohana Auth module supports easy development of custom authentication drivers by extending the Auth class holding abstract specifications of the required methods. I implemented these methods making use of the PHP Radius extension (which therefore is required). The driver is publicly available at GitHub.
I am planning on implementing a pure PHP Radius client to get rid of the requirement of the PHP Radius extension.
A couple of months ago I published my Kohana MySQLi database driver on GitHub. As the development of the framework came to a halt for the last few months the PHP team deprecated the support for the PHP MySQL extension on which Kohana’s default Database driver relies. This module is based on Kohana’s native implementation but uses the MySQLi extension.
A composer description is available in the repository so it can be easily installed using the package manager.