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

JoepH - October 3, 2007 - 12:04

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

vacilando - October 3, 2007 - 12:58

Thanks for the suggestion but.. no, I am on PHP v5.2.2

Any other ideas?

Tomas

#3

JoepH - October 3, 2007 - 13:35
Title:Does not autocomplete» Patch to make it php4 compatible

This the patch for my previous comment (#1)
It is my first Drupal patch ever so I hope it is in the right format.

AttachmentSize
textfield_autocomplete.module.patch 828 bytes

#4

JoepH - October 3, 2007 - 13:37
Status:active» needs review

Change the status

#5

vacilando - October 5, 2007 - 14:13

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

JoepH - October 6, 2007 - 10:47

I have no idea how to create a new version. I am not the module maintainer.

#7

vacilando - October 7, 2007 - 17:09
Category:support request» bug report
Status:needs review» reviewed & tested by the community

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

salvis - October 14, 2007 - 15:35

I also need this patch on PHP 4.4.0, and it works fine.

 
 

Drupal is a registered trademark of Dries Buytaert.