Ticket #34391 (closed enhancement: fixed)
php: remove readline dependency
|Reported by:||ryandesign@…||Owned by:||ryandesign@…|
The PHP SAPIs currently depend on readline. PHP is under the PHP license while readline is under the GPL and these two licenses are incompatible with one another. This is a problem because it means we cannot distribute binaries of the PHP ports. So I would like to remove the readline dependency.
PHP's readline dependency is partly a holdover from when php5 was a monolithic port. In #19091 I wanted to separate all the extensions into their own ports, and php5-readline became its own port in r53781, but was merged back into the php5 port in r56346. At the time I didn't document why, but the reason was that PHP has an interactive mode, "php -a", which supports readline, but only if it is built into PHP, not if it is built as a standalone extension.
A PHP bug report was filed about this in January 2011 and it was fixed in PHP trunk in February 2011. But that fix has not been back-ported to PHP 5; I expect users won't benefit from this fix until the release of PHP 6. The fix seems to affect a lot of files and contain more than a small amount of code and I don't know the PHP source code at all so I don't feel comfortable trying to back-port it to PHP 5 myself.
Readline was already an indirect dependency of php5 via the pcre port so there was no advantage at the time to removing the direct readline dependency. And regular expressions are a central feature of PHP which most PHP web sites probably use so there was no point separating out the pcre extension. But in the past year, the pcre port has been switched from readline to libedit, in r84236, to make it distributable. So now there is benefit in removing the readline dependency from PHP, to make it distributable too.
PHP can use libedit instead of readline. There is one problem with just replacing readline with libedit in PHP: there is one function, readline_list_history(), which is only available when the readline extension is built using the readline library, and not when it is built using the libedit library. Therefore there should be variants for letting the user choose libedit or readline, with libedit being the default.
Also, there's no reason readline functionality should be available in any SAPI other than the CLI.