Projects / upgrade.php


The upgrade.php script provides PHP backwards compatibility. It does so by automatically defining workalikes for more recently introduced PHP 5.2 or 6.0 core functions when run in an older interpreter version (like 4.1). This allows developers or projects to safely use the more advanced features of PHP while still supporting most applications that run on outdated servers. It emulates over 100 core functions and the complete FTP, ctype, GETTEXT, and mime_magic extensions, and comes with reasonable emulations for PDO, bcmath, ODBC, and the FILTER extension.


Recent releases

  •  24 Dec 2013 02:06

    Release Notes: The new PHP 5.5 functions array_column, json_last_error_msg, and boolval were added. Password_compat is included. Minor fixes were made to json_decode, and new wrapper functions mimicking the dated mysql_* extension with pdo_* prefixes were added, where pdo_query() provides easy-to-use bound parameters additionally.

    •  26 Jan 2012 15:22

      Release Notes: Some 5.4 functions have been implemented, and possibly a few bugs fixed. While gzdecode existed before, hex2bin, session_status, zlib_encode, zlib_decode, http_redirect, http_response_code, get_declared_traits (stub), and safe_unserialize are new. Various flags for json_encode/_decode like JSON_HEX_AMP have been added, or the newly (5.4) introduced JSON_PRETTY_PRINT, JSON_UNESCAPED_SLASHES, and JSON_UNESCAPED_UNICODE. A not-yet/non-standard JSON_PARSE_JAVASCRIPT has been implemented, as well as a basic json_last_error() function. It's a largely untested development release, however.

      •  23 Jun 2010 04:32

        Release Notes: Various new PHP 5.3 and 5.2 functions have been added. A new extension provides pspell functionality. Multiple errors have been fixed, such as example array handling in preg_filter and escaping in json_encode.

        •  20 May 2010 19:40

          Release Notes: Contributed fixes to json_decode() helped with compliance of the array conversion parameter. New PHP5.3 additions are preg_filter(), lcfirst(), parse_ini_string(), and array_replace(). Contrib modules have been rearranged. A new style object-oriented $_REQUEST[] input wrapper and data filter have been added.

          •  31 Jul 2007 06:09

            Release Notes: This release includes PDO emulation for PHP 4.x. This new unified PHP5 standard database interface prevents SQL injection exploits if you use its prepared statements instead of error-prone string concatenation and manual escaping. Other changes include more detailed phpDoc-style comments in the main script, and file_put_contents() support for the file locking flag. The emulated json_decode() function now supports Unicode escapes and still remains five times faster than JSON.php or the Zend_Framework decoder.

            Recent comments

            02 Feb 2014 18:28 agamemnus

            Hello. I tried your "pdo_mysql.php" library/wrapper. There is a big problem, though: when a duplicate entry is added to the database (and unique keys don't allow it), I get a PDO warning message echoed out, but pdo_error() doesn't return anything.

            24 Sep 2004 06:14 milky


            There is an alternative to the "upgrade.php" script, that already existed for a longer time. You can find it under ( and it is sometimes already installed on servers.

            The emulation functions of PHP_Compat ( are often a bit cleaner and behave more (Warning messages) like the native ones would. It is suddenly also not complete yet, but both projects can be used in conjuction easily.


            Project Spotlight


            A Fluent OpenStack client API for Java.


            Project Spotlight

            TurnKey TWiki Appliance

            A TWiki appliance that is easy to use and lightweight.