From:
Operating system: Ubuntu hardy linux 2.6
PHP version: 5.2.14
Package: Output Control
Bug Type: Bug
Bug description:Command line is appending a tab when using bash autocompletion
via a php script
Description:
------------
In order to write a bash autocompletion program using php, you need two
simple files.
1. bash script
2. php file processing the command and printing it
In this case, the autocomplete works but a "tab" is appended to the output
making it useless
The php script contains a simple "echo".
If I print the echo in python or ruby, it works properly (no tabs appended)
and
each time I press tab the command is printed.
That's how it should work for php as well.
Test script:
---------------
scriptPath='/home/hassen/workspace/scripts/bin/test.php'
_dda()
{
local cur
COMPREPLY=()
unset COMP_WORDS[0] #remove "j" from the array
cur=${COMP_WORDS[*]}
IFS=$'\n\n' read -d '' -a COMPREPLY < <($scriptPath --completion
"$cur")
return 0
}
complete -F _dda dda
alias dda=$scriptPath
----
test.php
<?php
echo "hello";
?>
Expected result:
----------------
"hello" should be appended each time I press "TAB"
Actual result:
--------------
Tabs are appended
--
Edit bug report at http://bugs.php.net/bug.php?id=52755&edit=1
--
Try a snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=52755&r=trysnapshot52
Try a snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=52755&r=trysnapshot53
Try a snapshot (trunk):
http://bugs.php.net/fix.php?id=52755&r=trysnapshottrunk
Fixed in SVN:
http://bugs.php.net/fix.php?id=52755&r=fixed
Fixed in SVN and need be documented:
http://bugs.php.net/fix.php?id=52755&r=needdocs
Fixed in release:
http://bugs.php.net/fix.php?id=52755&r=alreadyfixed
Need backtrace:
http://bugs.php.net/fix.php?id=52755&r=needtrace
Need Reproduce Script:
http://bugs.php.net/fix.php?id=52755&r=needscript
Try newer version:
http://bugs.php.net/fix.php?id=52755&r=oldversion
Not developer issue:
http://bugs.php.net/fix.php?id=52755&r=support
Expected behavior:
http://bugs.php.net/fix.php?id=52755&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=52755&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=52755&r=submittedtwice
register_globals:
http://bugs.php.net/fix.php?id=52755&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=52755&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=52755&r=dst
IIS Stability:
http://bugs.php.net/fix.php?id=52755&r=isapi
Install GNU Sed:
http://bugs.php.net/fix.php?id=52755&r=gnused
Floating point limitations:
http://bugs.php.net/fix.php?id=52755&r=float
No Zend Extensions:
http://bugs.php.net/fix.php?id=52755&r=nozend
MySQL Configuration Error:
http://bugs.php.net/fix.php?id=52755&r=mysqlcfg