For all those things you.... probably shouldn't have been doing anyway.... but surely do!

Replace, rename, and remove user defined functions and classes.
Define customized superglobal variables for general purpose use.
Execute code in restricted environment (sandboxing).

License: BSD License (3 Clause)

This package is not maintained anymore and has been superseded.

Latest releases

Version Release Download
1.0.4 2015-10-19 runkit-1.0.4.tgz
1.0.3 2015-10-19 runkit-1.0.3.tgz
1.0.2 2015-10-19 runkit-1.0.2.tgz
1.0.1 2015-10-19 runkit-1.0.1.tgz
0.9 2006-06-06 runkit-0.9.tgz
Show all releases


Version Message
1.0.4 New features:
+ PHP 5.4, 5.5, and 5.6 are now fully supported
- PHP 4.x is not supported anymore
+ Closures are now accepted by runkit_function_add, runkit_function_redefine, runkit_method_add, and runkit_method_redefine
This feature works in PHP 5.3 and above.
+ Introduced new function "runkit_default_property_remove" (Thanks to Juhan Kundla)
+ Ability to add non-scalar default properties was added
+ Magic methods __isset, __unset, __callStatic, serialize, unserialize, debugInfo and __toString are now supported.
+ Functions runkit_class_adopt & runkit_class_emancipate now change class-hierarchy (issue #13)
+ Adding and redefining functions and methods, which return references, were fully implemented
New optional argument 'return_ref' of functions runkit_function_add and runkit_function_redefine was introduced
New constant RUNKIT_ACC_RETURN_REFERENCE was introduced for use with functions runkit_method_add and runkit_method_redefine
+ Properties adding, removing, and importing were reworked for proper inheritance (including objects in PHP5+)
+ A new constant RUNKIT_OVERRIDE_OBJECTS was introduced. Use it by bitwise adding to the flags parameter
of functions runkit_default_property_add and runkit_import to add (and remove) properties of existing objects.
This feature works in PHP 5.x and above and it is switched off by default.
+ New (the third one) parameter remove_from_objects of boolean type was introduced
in runkit_default_property_remove function. Pass the TRUE value to remove property from existing objects.
This feature works in PHP 5.x and above. The default value for this parameter is FALSE.
+ Namespaces are fully supported by constants manipulation functions (Thanks to Antony Dovgal)
+ Allow disabling of allow_url_include in a Runkit_Sandbox (PHP >= 5.2) (Thanks to Sara Golemon)
+ New optional argument 'doc_comment' of functions runkit_method_add, runkit_method_redefine, runkit_function_add,
and runkit_function_redefine was introduced to specify doc_comments.
+ Preserve doc_comments on copying and redefining functions and methods.

Critical fixes:
* Highly probable crashes on using Reflection objects after modifying removing or renaming of functions, methods, and properties,
for which those Reflection objects have been instantiated, were eliminated
* Crash on sandbox creation when register_globals is switched on was fixed
* Building and working with PHP4 were fixed
* Crash on syntax error in source file importing with runkit_import was fixed
* The possible crash on manipulating constants having length less than two characters was eliminated
* Crash after using runkit_class_adopt when inherited methods access properties of the parent class (issue #59)
* Crash on calling renamed private/protected method (issue #64)
* Crash when copied function contains finally (issue #77) (Thanks to Antony Dovgal)
* Lists of directories in open_basedir sandbox setting are now supported

* All ways of adding and removing magic methods and old-style constructors
were reworked and corrected (Thanks to Anthony Dovgal for issues #35, #57, and #79).
* Side effect of redefining, adding and removing class constant (Issue #25) was eliminated
* Adding of non-lowercase default properties was fixed (removed lowercasing)
* Skip the leading slash in class names
* Copying, redefining, and renaming of functions were reworked
* Converting of input parameters (class names & function names) to lowecase was eliminated
* runkit_method_redefine function now sets the 'prototype' field for the method
and its descendants (Thanks to Anthony Dovgal)
* Freeing already freed memory on importing of a non-existent file was eliminated
* A test for correctness of runkit.superglobals feature was added
* Tests for correctness of inheritance of properties were added
* Tests for correctness of adding static properties were added
* Bug 57649 ( has been fixed without apathy ;)
Thanks to Sara Golemon for tests.
* Importing class extending another class was fixed (Issue #48) (thanks to mido0258)
* User-defined functions should remain after Runkit's shutdown
(thanks to Sara Golemon for code and to for test)
* Restoring of misplaced internal functions was corrected (issue #63)
* Delete temporary function on errors of adding/redefining methods
* runkit_method_add, runkit_method_copy, and runkit_method_rename now override derived methods (issue #62)

Build system improvements:
* PEAR Channel was introduced for releasing new packages
* Declarations after statement were restricted during compiling
* Warnings now will be treated as errors
* All tests now succeed under valgrind
* A compilation bug (with gcc 4.3+), caused by wrong definition of internal function,
was fixed (Thanks to Reeze Xia)
1.0.3 License was changed to the BSD License (3 Clause)
Main bug-fixes:
* Building on windows-platform was fixed.
* The issue with inheritance of methods, which have been created by the runkit_method_rename function, was fixed.
* Fixed dumb bug in workarounds based on php-version.
1.0.2 Disappointing incompatibility issue with php 5.3+ in untested code was fixed.
1.0.1 New features:
+ The patch made by David Sklar was applied to support creation and changing of static methods.
The new user-level const "RUNKIT_ACC_STATIC" was introduced.
+ An ability to import static class properties was added.
The new user-level const "RUNKIT_IMPORT_CLASS_STATIC_PROPS" was introduced.
+ An ability to apply a closure to a sandbox in PHP 5.3+ by calling the call_user_func method was added.

Main bug-fixes:
* Fixes of issues with importing constant arrays into properties and constants
* Fixes of issues with importing functions or methods having static variables inside them
* The behaviour that old methods had been always overridden by new ones independently from
the RUNKIT_IMPORT_OVERRIDE flag was corrected
* Compatibility with 5.3+ in zts mode
* runkit_function_* functions were fixed with the patch from Keisial at gmail dot com
(see the second comment from
* The reverting of protected methods via runkit_method_copy was corrected, the segmentation fault
on calling restored method was eliminated
* Elimination of the segmentation-fault on exit after restoring modified internal functions
(see also
* Correction for the situation when a method or function having static variables in itself
and copied by runkit crashes afterwards on calling if the original method or function was removed
* The issue that the runkit used to create new methods with lowercase names was fixed, tests were extended
* Methods' prototype detection was fixed
0.9 Allow building part of runkit while leaving other functionality out.
--enable-runkit works as before, building all runkit features
Individual features may enabled or disable by using
--enable-runkit-featurename or --disbale-runkit-featurename
where featurename is any of:
modify - Runtime manipulation
super - Superglobal registration
sandbox - Sandboxing

Ex: ./configure --enable-runkit --disable-runkit-modify
Enable superglobal registration and sandbox support,
but disable runtime manipulation.

./configure --disable-runkit --enable-runkit-sandbox
Enable only sandboxing support.

This release also:
- Fixes PHP4 (ZE1) compilation
- Closes a potential crash-bug in runkit_import()
handling of default properties
- Resolves an output buffering bug in Runkit_Sandbox
- Resolves Runkit_Sandbox failure when superglobals are defined
Show complete changelog