Fatal error: Unsupported operand types in /home/un/public_html/personal/includes/form.inc on line 342

Comments

stella’s picture

I also get an error when clicking on "By Location" on the search form.

Fatal error: Cannot unset string offsets in /var/www/drupal_5.1_20070219/html/includes/form.inc on line 319

Then when I hit the back button, to return to my search form, I get the following errors:

* warning: Illegal offset type in /var/www/drupal_5.1_20070219/html/includes/form.inc on line 208.
* warning: call_user_func_array() [function.call-user-func-array]: First argument is expected to be a valid callback, 'Array' was given in /var/www/drupal_5.1_20070219/html/includes/form.inc on line 218.
 * warning: htmlspecialchars() expects parameter 1 to be string, array given in /var/www/drupal_5.1_20070219/html/includes/bootstrap.inc on line 588.
andrew m riley’s picture

I'm receiving the same errors, here's my system info:

Drupal 5.1
MySQL database 5.0.27
PHP 5.2.0
Unicode library PHP Mbstring Extension
Webserver Lighttpd

Scott Reynolds’s picture

I recieved both those errors. I recieved the illegal operand when using php4

recieved string offset error when i upgraded to php5. Hopes that helps those seeking to fix this. I am working on it too i promise

geograt’s picture

With 5.x-1.x-dev (2007-Feb-25) I confirm the same: Fatal error: Unsupported operand types in XXX/includes/form.inc on line 342
And in the watchdog:

1.- Illegal offset type en la línea 208 del archivo xxx/includes/form.inc.

2.- call_user_func_array() [function.call-user-func-array]: First argumented is expected to be a valid callback, 'Array' was given en la línea 218 del archivo xxxx/includes/form.inc.

htmlspecialchars() expects parameter 1 to be string, array given en la línea 588 del archivo xxxx/includes/bootstrap.inc.

I am using php4 and mysql 4.1.

jo1ene’s picture

Me too. Same as #1

ankur’s picture

I've noticed this myself and it is the only reason I haven't made a Drupal 5 release announcement for it yet. I'm kind of strapped for time. If someone else can take a look at it in the meantime, please do. Otherwise, we'll just have to wait til I get some spare time, which might be a long, long time.

It's easier for me to review the queue on the weekends, but I've already spent some 10-15 hours trying to figure out why the search form won't render properly. At this point, this is something that'll require me to sit down with it for at least 4-5 un-interrupted hours which, again, I don't have and won't seem to have until I get a break or until my employer needs the search function to work on Drupal 5.

Also, I encourage anyone with the time, to perhaps take a look at locationsearch. It was a sandbox project for 4.7 that never reached completion. It would be the preferable alternative to the current (and broken) search functionm if someone can make it work because it tries to merge the location search into the search forms provided by Drupal core.

But if someone can get the current implementation working, I'll commit it right away.

ankur’s picture

If anyone is interested in making it work and updating it, you can find the incomplete locationsearch project at http://cvs.drupal.org/viewcvs/drupal/contributions/sandbox/nedjo/modules...

vangorra’s picture

StatusFileSize
new77.13 KB

Hey Ankur,
I have come across the same problem. I see you are busy, so I have done my best to fix the problems that exist. This is my first whack at a drupal module, but it seems to work just fine. Hope this helps you and everybody else.

Wasn't sure what format you would want the attachment, so I sent the whole module, let me know if you want a .patch file.

ankur’s picture

StatusFileSize
new6.11 KB

Hey vangorra,

Thanks for the patch. I tried it, but still get the error that I've been getting everytime I've tried to mess with it myself:

Fatal error: Unsupported operand types in /var/www/localhost/htdocs/drupal50/includes/form.inc on line 343

Also, the directory name /drupal50/ is misleading. It is actually an up-to-date CVS checkout of the DRUPAL-5 branch.

Perhaps you had to modify another file or something?

I'll try to play with it, but I haven't been able to figure out what causes this line of form.inc to throw an error, but I've seen it a couple time in other projects and I never know what I actually changed that fixed it. It would be cool if the Form API had some kind of "debug" or "devel" mode where the form array is checked for errors instead of just spitting out this hard to trace bug that keeps popping up.

I've attached a copy of the patch that would give you the version of the module posted in the previous comment.

jo1ene’s picture

Status: Active » Needs work

+1 for #8 and #9

This gets the location searching to work on 5.0 for me. The formatting could use some work, though. A couple of other things.

* Should ZIP should not be mandatory? It may or may not always be applicable in an international setting.
* The country selection should include all countries checked off in the settings. Right?

Thanks for your work on this. It's a GREAT improvement!

vangorra’s picture

ankur, (#9)
I didn't mention what version of location I was patching against. This is suppose to patch against the most recent dev release of the location module for drupal 5.0 available for download on the project site. I've not even looked at the cvs nor sure if I ever will. I hope that my lack of communication is the problem, because I don't like producing code that does not work.

Regarding comment #10. Glad I could help somebody! That makes it all worth while.
I think that zip and country should both be required just as the module is setup. Because there exist postal codes that match in Australia, UK and Canada, but they are different countries. Perhaps future discussion can be done to improve this, but for now, I'm just trying to get the bad boy working. :)

geograt’s picture

just to confirm that vangorra patch work for me. What we can do to make others selected country appear in the country search field?
Thanks

vangorra’s picture

StatusFileSize
new77.5 KB

ankur, geograt,
I noticed that the country list does not populate with the supported countries chosen in the location admin page. So now it does.

Scott Reynolds’s picture

As per comment #10 please not this issue for that: http://drupal.org/node/89220

Some of us are doing some work with it. I hope to have a small patch soon but it doesn't work with wrap around (i.e it works like you had the map of the world lay out flat so one end of the map isn't close to the other end).

vangorra’s picture

ankur,
What more needs to be done to my patch is order to close this bug report?

geograt’s picture

vangorra, speaking about your follow #11, please you can take look at http://drupal.org/node/89220#comment-208390, is there any chance to improve search without zip code?

ankur’s picture

Status: Needs work » Fixed

I went ahead and committed the thing to DRUPAL-5, though, as mentioned in the previous comment, we should really move this to a search that uses the lat/lons in the location table rather than the list of zipcodes selected from the lat/lons in the zipcodes table.

-Ankur

vangorra’s picture

Agreed, for future development an improved search feature would be very helpful. I will post some suggestions for development, I unfortunately lack experience in lat/lon radius algorithms.

Anonymous’s picture

Status: Fixed » Closed (fixed)