Patch to make it php4 compatible
vacilando - September 28, 2007 - 21:01
| Project: | Textfield Autocomplete |
| Version: | 5.x-1.x-dev |
| Component: | Code |
| Category: | bug report |
| Priority: | critical |
| Assigned: | Unassigned |
| Status: | reviewed & tested by the community |
Description
Hi,
Finally I thought I found the right autocomplete.. just something in CCK that offers matches in the same field.
So I added it in a content type, created a test field country and went on to create its first node. In that field I typed "Czechoslovakia" and saved it. Then created another node and I expected that the country field would autocomplete from "Czec" to that country's name. However, nothing happens, the search wheel keeps spinning forever.
Is there a bug, if so, can you supply a solution? I need this real quick.. hope you are there and can look at it as soon as possible.
Thanks,
Tomas

#1
Same problem found here.
You will need PHP5 in order to get this to work.
It is caused by the call to array_combine function on line 165.
If you are on PHP4 then change the following piece of code:
while ($row = db_fetch_array($result)) {
foreach ($row as $colname => $colval) {
$items[] = $colval;
} // foreach col value
} // while there's rows
} // foreach table
if ($items) { $items = array_combine($items, $items); }
to this:
while ($row = db_fetch_array($result)) {
foreach ($row as $colname => $colval) {
$items[$colval] = $colval;
} // foreach col value
} // while there's rows
} // foreach table
//if ($items) { $items = array_combine($items, $items); }
Joep
#2
Thanks for the suggestion but.. no, I am on PHP v5.2.2
Any other ideas?
Tomas
#3
This the patch for my previous comment (#1)
It is my first Drupal patch ever so I hope it is in the right format.
#4
Change the status
#5
Wow, joepH -- that worked! You can roll out a new release based on the patched code. Thanks!
Just to remind you, I needed this patch even though I am on PHP 5.2.2 (so this thread's title is a bit misleading).
Tomáš
#6
I have no idea how to create a new version. I am not the module maintainer.
#7
JoepH, you are of course correct. Hopefully linuxbox is reading this and will apply this patch as soon as possible and roll out a new version.
#8
I also need this patch on PHP 4.4.0, and it works fine.