Drupal Override Function

crystaldawn - March 29, 2009 - 09:17

NOTE: This module REQUIRES that you install the PECL Apd PHP Extension. You can find installation instructions here:
http://us2.php.net/manual/en/apd.setup.php NOTE: APD is NOT compatible with ZendOptimizer. Personally I dispise Zend because it encourages closed source software. Thus I am not a fan of Zend to begin with so I could careless if ZendOptimizer is disabled.

Without it, it will not work because it needs access to the override_function and rename_function functions. This installation is actually very easy. For most servers a simple call to pear install apd OR pear install pecl/apd will work just fine. Then you can enable the extension in php.ini just like any other extension, restart apache, and you are done. If your server doesnt have a pear command, most linux distros will have a package management system that can install pear easily (apt-get install php-pear or something like that).

This module is VERY powerful and VERY dangerous if used in the wrong manor. It allows you to override ANY PHP function. An example is that you could override the PHP print_r function and make your OWN print_r function. Without having to rename it to something like my_print_r(). This allows you to much with things you probably shouldnt be mucking with, but one prime example is giving Drupal 5/6 jQuery compatibility mode. The ONLY way to do this previously was to actually modify the core files. Now with this module we can modify the core functions WITHOUT modifying the core files themselves. Please look at the jQuery_compatibility_mode module to see how this is done. It shows you how to modify a function without losing the ability to update them through a regular drupal update.

The ONLY time you need to be installing this, is if you are developing a module to use this module or another module is telling you to install it as a dependency.

WARNING! DO NOT attempt to override PHP functions if you use Pecl APD version 1.0.1. There seem to be some bugs with the APD version 1.0.1 that causes random Segmentation faults and just plain weirdness. If you stick to just overriding NON-built in PHP functions, it works great. But as far as overriding print_r or something like that, uh, dont try it. I have not tried any other versions of APD. If you find a version that lets you do this, please let me know so I can add that as a requirement for this module ;) Yea it would be cool it it worked, but unfortunately my experience has been that it only half works.

Development and maintenance by CrystalDawn.net & Kappaluppa Company

Releases

Official releasesDateSizeLinksStatus
6.x-1.42009-Mar-296.67 KBRecommended for 6.xThis is currently the recommended release for 6.x.
5.x-1.42009-Mar-296.65 KBRecommended for 5.xThis is currently the recommended release for 5.x.


 
 

Drupal is a registered trademark of Dries Buytaert.