php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #47949 Return value of a registered completion function is not tested
Submitted: 2009-04-11 12:14 UTC Modified: 2009-04-13 18:08 UTC
Votes:1
Avg. Score:3.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: rannou dot sebastien at gmail dot com Assigned:
Status: Not a bug Package: Readline related
PHP Version: 5.2.4 OS: GNU/Linux
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: rannou dot sebastien at gmail dot com
New email:
PHP Version: OS:

 

 [2009-04-11 12:14 UTC] rannou dot sebastien at gmail dot com
Description:
------------
If the registered function from readline_completion_function returns an empty array, a segmentation fault happens when trying to tab.

Reproduce code:
---------------
<?php

// script.php

function  foo()
{
    return array();
}

readline_completion_function('foo');

while (42)
   echo readline('> ');

?>

Expected result:
----------------
Doing nothing or printing a new prompt.

Actual result:
--------------
$> php script.php
> 
Segmentation fault
$>

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-04-11 17:14 UTC] felipe@php.net
Thank you for this bug report. To properly diagnose the problem, we
need a backtrace to see what is happening behind the scenes. To
find out how to generate a backtrace, please read
http://bugs.php.net/bugs-generating-backtrace.php for *NIX and
http://bugs.php.net/bugs-generating-backtrace-win32.php for Win32

Once you have generated a backtrace, please submit it to this bug
report and change the status back to "Open". Thank you for helping
us make PHP better.

I can't reproduce it using libreadline 5.2-4.
 [2009-04-11 18:04 UTC] rannou dot sebastien at gmail dot com
Sorry for my mistake, I thought it was with php-5.2.9, but it seems only to happen on 5.2.4.

$ php -v
PHP 5.2.4-2ubuntu5.5 with Suhosin-Patch 0.9.6.2 (cli) (built: Feb 11 2009 20:09:52)

Here's the gdb trace:

Core was generated by `php segfault.php'.
Program terminated with signal 11, Segmentation fault.
[New process 18508]
#0  0xb7f5214a in ?? () from /usr/lib/libedit.so.2
#1  0xb79e3cca in ?? () from /lib/tls/i686/cmov/libc.so.6
#2  0xb79e46b7 in qsort () from /lib/tls/i686/cmov/libc.so.6
#3  0xb7f51c3f in fn_display_match_list () from /usr/lib/libedit.so.2
#4  0xb7f5201b in fn_complete () from /usr/lib/libedit.so.2
#5  0xb7f577ce in rl_complete () from /usr/lib/libedit.so.2
#6  0xb7f577f9 in ?? () from /usr/lib/libedit.so.2
#7  0xb7f4cd36 in el_gets () from /usr/lib/libedit.so.2
#8  0xb7f58dc5 in readline () from /usr/lib/libedit.so.2
#9  0x08353d57 in zif_readline ()
#10 0x082f4c0b in ?? ()
#11 0x082e5648 in execute ()
#12 0x082c4443 in zend_execute_scripts ()
#13 0x0827a2b0 in php_execute_script ()
#14 0x08356a0a in main ()
(gdb)

I've very sorry once again. I re-open the ticket in case it interests you.

Thanks for your attention :-)
 [2009-04-13 18:08 UTC] jani@php.net
Thank you for taking the time to report a problem with PHP.
Unfortunately you are not using a current version of PHP -- 
the problem might already be fixed. Please download a new
PHP version from http://www.php.net/downloads.php

If you are able to reproduce the bug with one of the latest
versions of PHP, please change the PHP version on this bug report
to the version you tested and change the status back to "Open".
Again, thank you for your continued support of PHP.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Oct 10 14:01:27 2024 UTC