HipHop for PHP: Unimplemented functions and features

Because of various incompatibilities and installation difficulties HipHop for PHP is not the right solution for everyone deploying PHP.

In this article I present you the documentation about unimplemented functions in HipHop for PHP compiler. This is an enhanced copy of the github’s documentation which has been deleted from project’s website three days ago by unknown reason.

The article has been enhanced with my own notes to make it up-to-date and more friendly for the end-users.

Unsupported features

General PHP features not supported:

  1. Runtime code evaluation using eval() or create_function()
    Works in the hphpi interpreter, but not the hphp compiler
  2. Ordered use of function_exists() or class_exists() or get_declared_functions() or get_declared_classes()
    in order to determine whether to include another file or not or see the affect of including another file – UNLESS the HDF AllVolatile option is enabled
  3. Dynamic function calls
    Such as calling a function by name stored in a variable UNLESS the HDF AllDynamic option is enabled
  4. The preg_replace “/e” option
    All the other options work fine

Unsupported extensions

Some extensions that people commonly use are not supported, particular:

  1. Zip
  2. FTP
  3. SimpleXML
    Support for SimpleXML is still incomplete. PHP scripts may become unstable when using this functionality.

  4. MySQLi
    Please note that HipHop for PHP has PDO (for MySQL) and an old MySQL extensions enabled
  5. Non-MySQL database APIs.
    PostgreSQL, Microsoft SQL, Oracle and other.

Unimplemented functions

Functions not implemented:

  1. get_browser()
  2. get_cfg_var()
  3. getlastmod()
  4. highlight_file()
  5. highlight_string()
  6. ob_get_status()
  7. ob_gzhandler()
  8. output_add_rewrite_var()
  9. output_reset_rewrite_vars()
  10. parse_str()
  11. register_shutdown_function()
  12. set_include_path()
  13. show_source()
  14. stream_context_set_option()
  15. stream_get_wrappers()
  16. unserialize_callback_func()
  17. zend_logo_guid()
  18. zend_version()
  19. zlib_get_coding_type()
  20. some SPL functions: spl_autoload_register()
  21. some others

Unimplemented settings

PHP config settings not implemented:

  1. track_errors
  2. include_path
  3. display_errors
  4. many others (it may be that just memory_limit, max_execution_time, and arg_separator.output work)
    Developers should look at the options available through Nginx, and the HDF file, for configuring the server instance. Most of PHP’s options are not very important, especially for a high performance production server, but those mentioned above are likely to be the biggest issues for people.

Other unsupported features

Other features not supported:

  1. Case insensitive constants (set via a special parameter to the define() function)
  2. Socket access to stdin/stdout
  3. Automatic rolling over of integers to floats if bounds are exceeded (on 64bit servers it’s much smaller issue than on 32-bit system, plus a performance issue)
  4. Compiled executables initialise global variables to NULL, so you won’t get an error if you reference an undefined variable

Other compatibility problems

Other compatibility problems may have been reported as issues:

Things to remember

Generally you should avoid sloppy coding practices, such as:

  1. Coercing variables into arrays or objects by using inappropriate operators on them
  2. Generally it’s best to try and be type-strict in order to get maximum performance

An insightful presentation on the design of HipHop PHP is available below:

Tags: ,

Leave a Reply