Re: [PATCH] readline extension bug fixes and enhancements
On 03/20/2012 12:06 PM, Osama Abu Elsorour wrote:
All,
I was recently involved in a project that relied heavily on readline to provide console text input capabilities. However I soon noticed that the current readline extension has a serious bug and is lacking some important functionality.
This patch applies only to PHP compiled with libreadline (and don't have an effect if compiled with libeditline). It adds/modifies/fixes the following:
- Fixes memory corruption caused by directly setting rl_line_buffer to new buffer and not using rl_replace_line().
- Fixes a bad combination of preprocessor #if that would cause readline_on_new_line() implementation not to compile when using libreadline only.
- Adds support for rl_bind_key function by exposing:
function readline_bind_key_function($key, $callback_func)
where:
$key: Key code to bind to.
$callback_func: A callback function in the form:
function callback($key, $count) where $key and $count are the same parameters passed from rl_bind_key()
Setting $callback_func to null will cause the binding to be removed for $key.
- Modifies the behavior of readline_info() to allow for setting the readline properties "point" and "end" (it used to only read them but not set them).
Patch below:
To avoid your patch getting lost in the mail archives, what about trying out the new github integration?: https://wiki.php.net/vcs/gitworkflow#workflow_for_external_contributors
Or log a bug (https://bugs.php.net/) and attach the patch.
Chris
--
Email: [email protected]
Tel: +1 650 506 8630
Blog: http://blogs.oracle.com/opal/
Thread (4 messages)