Closed (fixed)
Project:
Webform
Version:
6.x-2.6
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
26 Jun 2008 at 18:47 UTC
Updated:
15 Feb 2010 at 09:11 UTC
I tried to use %session in a hidden field and I got the following error message everytime I viewed the form:
Recoverable fatal error: Object of class stdClass could not be converted to string in webform\webform.module on line 2079.
I think I managed to track the error down to a $node-object which I accidentially stored in $_SESSION somewhere else in my application, and the error is caused by a str_replace call in webform.module; I guess a simple if (!is_object(...)) at the right place would solve the problem, but I'm not sure if that's the best way... ?
Comments
Comment #1
quicksketchThe token replacement would also fail if it ran into an array unexpectedly. For the time being I've just caste the replacement to a string to ensure it'll be replaced properly.
Comment #2
Anonymous (not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.
Comment #3
flevour commentedIf $value is not a string, $replace and $find mess up, as they won't contain the same number of elements.
The patch below inserts an empty string replacement string in order to keep the 2 arrays in line.
Comment #4
quicksketchThis was corrected in the 2.7 version, which uses an entirely different replacement mechanism. Please reopen if the problem continues to exist.
Comment #5
tanguitcho commentedHello ,
I'm trying to use %session with an array as a default value of a textfield : e.g. %session[myarray][key1]
However this is not working I get something like Array[key1] in the textfield ..
I've browsed a while for a possible solution but couldn't find any.
can anyone help me with this
thx
Config :
Drupal 6.x
webform 2.9