Hi there,

Here is my issue: I can create a node containing a date (popup widget) and save it, the date will appear on the node view. If I want to get back to the editing, the date is empty.

Everything was working fine under PHP 5.3, now that my server is running PHP 5.4 I have the same issue for several websites. Running the same website on a PHP 5.3 localhost will make everything work again...

Not sure if related, seems to be the same issue for other modules:
http://drupal.org/node/1159880
http://drupal.org/node/1453570

Any ideas???

Thanks

Comments

jackalyst’s picture

This is my exact same issue.

In my logs I get "Illegal string offset 'month' in /.../includes/form.inc on line 1345"

Same error applies for second, hour, day, year...

ptitwolfy’s picture

Anyone else with same the issue? Any ideas how to fix it?
Thanks

MEGAWATT’s picture

use this to fix 1345 http://drupalcontrib.org/api/drupal/contributions%21date%21date_popup%21...
but it do not fix echo date time and time

MEGAWATT’s picture

Assigned: Unassigned » MEGAWATT

how to looks date and time in page node edit , drupal 6, php 5.4.6
do this:
1st of all fix you code similarity http://drupalcontrib.org/api/drupal/contributions%21date%21date_popup%21...

all changes in date/date_popup/date_popup.module

1. in function date_popup_process_date change

'#default_value' =>(!empty($element['#value']['date']) || !empty($edit['date'])) && is_object($date) ? date_format_date($date, 'custom', $date_format) : '',

change to

date_format_date($date, 'custom', $date_format) ,

next step

if (!empty($element['#force_value'])) {$sub_element['#value'] = $sub_element['#default_value']; } 

change to

$sub_element['#value'] = $sub_element['#default_value'];

2. in function date_popup_process_time change

'#default_value' =>(!empty($element['#value']['time']) || !empty($edit['time'])) && is_object($date) ? date_format_date($date, 'custom', $time_format) : '',
 

change to

date_format_date($date, 'custom', $time_format) ,

and

 if (!empty($element['#force_value'])) {$sub_element['#value'] = $sub_element['#default_value']; } 

change to

$sub_element['#value'] = $sub_element['#default_value'];.
ptitwolfy’s picture

Thanks so much, it's working perfectly now!

indydas’s picture

This fix didn't work for me. When I use date and time too after a content type import the dates and times are empty.

nicobot’s picture

Subscribing [#4] fixes the problem for me, actually just taking out the conditional

(!empty($element['#value']['time']) || !empty($edit['time'])) && is_object($date) ? 

works like a charm :)

Interesting thing,
$element['#value'] = "2013-01-01";

In PHP 5.3:
empty($element['#value']['date']) ? => true

PHP 5.4:
empty($element['#value']['date']) ? => false

Thanks!

bkat’s picture

StatusFileSize
new1.18 KB

All you need to do is remove the ['time'] from $element['#value']['time'] in date_popup_process_date and date_popup_process_time

Works for me in php 5.4.10 and 5.2.17.

Patch included -- built against 6.x-2.9+6-dev

greenskunk’s picture

After upgrading to PHP 5.4.10 from PHP 5.2.x, I had the issue when editing the date fields that used the date popup were empty. Patched 2 sites Drupal 6 sites running on PHP 5.4.10 and date fields are populated again.

Others please review and test.

Thank you fellow Drupalers!

tajindersingh’s picture

#8 works perfect.

rterrero’s picture

#8 works perfect for me too!

powery’s picture

#8 works fo me, please send it to the dev version

ryan_courtnage’s picture

Status: Active » Reviewed & tested by the community

#8 working here

Status: Reviewed & tested by the community » Needs work

The last submitted patch, date_popup.module.patch, failed testing.

arlinsandbulte’s picture

Status: Needs work » Needs review

#8: date_popup.module.patch queued for re-testing.

Status: Needs review » Needs work

The last submitted patch, date_popup.module.patch, failed testing.

NaX’s picture

#8 Worked for me, thanks.

ice5nake’s picture

Patch worked for me.

I had to use the patch command without the -p1 to get it to work for me.

I've seen patches sit in "needs work" because of a failed test more than once.

It'd guess the test failed because the test uses the -p1 option

git apply --check -p1 /var/lib/drupaltestbot/sites/default/files/review/date_popup.module.patch

mikeytown2’s picture

Version: 6.x-2.9 » 6.x-2.x-dev
Status: Needs work » Needs review
StatusFileSize
new1.37 KB

Rerolled #8

Adding in text for search purposes

Warning: Illegal string offset 'year' in _form_set_value() (line 1345 of includes/form.inc).
Warning: Illegal string offset 'month' in _form_set_value() (line 1345 of includes/form.inc).
Warning: Illegal string offset 'day' in _form_set_value() (line 1345 of includes/form.inc).
Warning: Illegal string offset 'hour' in _form_set_value() (line 1345 of includes/form.inc).
Warning: Illegal string offset 'minute' in _form_set_value() (line 1345 of includes/form.inc).
Warning: Illegal string offset 'second' in _form_set_value() (line 1345 of includes/form.inc).

kerasai’s picture

#19 applied cleanly to 6.x-2.9 for me and allowed the date values to render on node edit screens.

+1 RTBC

kerasai’s picture

densolis assisted me to find out that the test is not running due to the 6.x-2.x branch not passing testing. In order to move forward either the patch need to be manually reviewed or a maintainer needs to fix up the branch so the patch can be automatically tested.

mattwmc’s picture

19 worked.

Thanks a lot.

mikeytown2’s picture

Status: Needs review » Reviewed & tested by the community
m.stenta’s picture

+1 on the RTBC... this fixed the issue on my site.

cafuego’s picture

Status: Reviewed & tested by the community » Fixed

Patch applied and pushed to 6.x-2.x. Thank you!

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

interestingaftermath’s picture

I've applied the patch and I've also upgraded to 6.x-2.x but I am still experiencing this issue. Anyone else?

Projet Oeb’s picture

Issue summary: View changes

interestingaftermath, try dev version.

cyxair’s picture

Same issue here , with 6.x-2.10 and 6.x-2.x-dev.