Drupal HH7 project: HipHop for PHP and Drupal 7.2 compatibility patch

Drupal 7.2 was released about five days ago. Today, I’m proud to announce the next version of Drupal 7.x patch adding support for HipHop for PHP source code transformer.

Drupal HH7 Version: 1.1
Release date: 30-05-2011
Compatible with: Drupal 7.2
Not compatible with: HipHop branches 36a16fb and 6044908 and Drupal 7.0-7.1
Tested on HipHop branch: 806ee06 and earlier

Modules compatibility list can be found at the end of this article. Please report any patch issues in the comments to this annoucement.


Latest HipHop for PHP branches seems buggy and do not work with Drupal 7.x. In order to compile Drupal 7, you have to use earlier version of HipHop for PHP or wait for Facebook development team to fix this issue.

Installing and patching

You can install this patch in two different ways. Either by patching the original Drupal 7.2 source code using the diff file or by downloading already patched Drupal source code from the link below.

Please, read this article for futher info on how to apply the patch or compile Drupal 7.2 using HipHop for PHP.

Download links

  1. Drupal 7.2 patch
  2. patched Drupal 7.2 source code

Warning!This version of Drupal patch is compatible only with Drupal 7.2. To patch older versions of Drupal, read this article instead.

Modules compatibility

Module name Status
Version Notes
Drupal Core OK (1.0) 100% -
Install. wizard OK* (1.0) 90% * manual rebuild required to apply database settings
Aggregator OK (1.0) 100% -
Block OK (1.0) 100% -
Blog Not tested - -
Book Not tested - -
Color Not tested - -
Comment OK (1.0) 100% -
Contact Not tested - -
Content transl. Not tested - -
Context. links Not tested - -
Dashboard OK (1.0) 100% -
Database logging OK (1.0) 100% -
Field OK (1.0) 100% -
Field SQL stor. OK (1.0) 100% -
Field UI Not tested - -
File Not tested - -
Filter OK (1.0) 100% -
Forum OK (1.1) 100% -
Help OK (1.0) 100% -
Image Not tested - -
List Not tested - -
Locale Not tested - -
Menu Not tested - -
Node OK (1.0) 100% -
Number Not tested - -
OpenID Not tested - -
Options Not tested - -
Overlay OK* (1.0) 90% 404 error directly after installation (uses pretty URL’s without permission)
Path Not tested - -
PHP filter Not tested - -
Poll Not tested - -
RDF Not tested - -
Search OK (1.1) 100% -
Shortcut Not tested - -
Statistics OK (1.0) 100% -
Syslog Not tested - -
System OK (1.0) 100% -
Taxonomy Not tested - -
Testing Not tested - -
Text OK (1.0) 100% -
Toolbar OK (1.0) 100% -
Tracker OK (1.0) 100% -
Trigger Not tested - -
Update manager OK* (1.0) - * does not update automatically
User OK (1.0) 100% -


1.1 – Support for Drupal 7.2
1.0 – Initial release:

  1. [spl_autoload_register] – HipHop for PHP falls into an infinite loop while the autoloader handler tests whether a given class exists. Class and interface checking has been turned off in the compiled application.
  2. [traversable] – HipHop for PHP does not support the Traversable interface in a class that handles the PDO statements. Foreach loops have been modified to use the fetchAll() method.
  3. [filter] – HipHop does not support the filter module. filter_var() function has been replaced by regular expressions.
  4. [streams] – HipHop for PHP does not support the stream_get_wrappers() function. In compiled version Drupal returns an array containing only two fixed values​​: file, http.
  5. [foreach/reset] – Added reset() clause after few foreach loops. HipHop for PHP does not like mixing next()/current()/each() functions with arrays that have been already iterated by the foreach loop
  6. [func_get_args()] – some versions of HipHop for PHP fail to compile Drupal 7 when calling func_get_args() function with a reference operator on the left (ie $x = &func_get_args()). The reference operator has been removed from the source code.

Tags: , ,

3 Responses to “Drupal HH7 project: HipHop for PHP and Drupal 7.2 compatibility patch”

  1. sun says:

    Nice work!

    I see a lot of changes along the lines of

    - $result = $query->execute();
    + $result = $query->execute()->fetchAll(PDO::FETCH_OBJ);

    in this patch. Isn’t that identical to the default fetch mode and result of ->execute()?

    Wondering whether the patch couldn’t be a lot smaller if you’d simply adjust the database driver instead; i.e., sort of once for all. Extending the db driver query class into a mysql_hiphop implementation may also be doable.

    At least it looks like you could cut down 90% of the 122KB patch this way.

    Lastly, it would be lovely to move this development effort into a git sandbox/project on Do you know whether there’s a project for that already?


  2. sun says:

    Didn’t find you on Twitter. You’ve now commit access to :)

  3. Artur Graniszewski says:

    Yes, that’s true, $query->execute()->fetchAll(PDO::FETCH_OBJ) should be identical to $query->execute(), unfortunately for unknown reasons HipHop for PHP does not like Traversable and Iterable interfaces implemented on deriverates of the PdoStatement class. In result, every foreach() statement fails, because HipHop iterates through internal properites of the class, rather than fetching new db records.

    It was much easier for me to change all those lines to fetchAll() because of the time constrains and problems with debugging compiled Drupal 7 (not everything is logged when application fails, etc.). I’ll try to investigate it this week and create something more elegant.

    Thanks for giving me the commit access, from now on I’ll maintain this project from the sandbox you created for me.

Leave a Reply