Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I get the following errors when an Event (CiviCRM Multiday) is created via Add Content or when an existing event is edited and saved.
Notice: Undefined index: value in civicrm_multiday_event_node_presave() (line 354 of ..\sites\all\modules\civicrm_multiday_event\civicrm_multiday_event.module).
Notice: Undefined index: value in civicrm_multiday_event_node_presave() (line 356 of ..\sites\all\modules\civicrm_multiday_event\civicrm_multiday_event.module).
Warning: array_flip() [function.array-flip]: Can only flip STRING and INTEGER values! in EntityAPIController->load() (line 219 of ..\profiles\commerce_kickstart\modules\contrib\entity\includes\entity.controller.inc).
Warning: array_flip() [function.array-flip]: Can only flip STRING and INTEGER values! in EntityAPIController->load() (line 219 of ..\profiles\commerce_kickstart\modules\contrib\entity\includes\entity.controller.inc).
Notice: Trying to get property of non-object in civicrm_multiday_event_node_presave() (line 379 of ..\sites\all\modules\civicrm_multiday_event\civicrm_multiday_event.module).
Notice: Trying to get property of non-object in civicrm_multiday_event_node_presave() (line 380 of ..\sites\all\modules\civicrm_multiday_event\civicrm_multiday_event.module).
This is on a site running Commerce Kickstart 7.x-2.13 with Entity API 7.x-1.3. I'm not sure if this is an issue with CiviCRM Multiday or the Entity modules (or both).
Comment | File | Size | Author |
---|---|---|---|
#21 | 2271335-array_flip_wsod.patch | 768 bytes | coderdan |
#18 | Screen Shot 2014-08-23 at 9.31.09 AM.png | 174.29 KB | coderdan |
Comments
Comment #1
bcobin CreditAttribution: bcobin commentedI'm having the same issue, but I'm not running Commerce Kickstart:
https://drupal.org/node/2228821
I think there's something different in Civi 4.4.5, but I've not heard anything for about a month now...
Comment #2
seascoot CreditAttribution: seascoot commented@bcobin
I should have mentioned -I'm on Civi 4.4.5.
Comment #3
coderdan CreditAttribution: coderdan commented@seascoot: First, what you are seeing are PHP warnings and notices. Note these are not the same things are outright errors and shouldn't be preventing things from working (you don't have PHP notices enabled on a production site do you?). Second, I cannot replicate your problem and will need more details. What version of Drupal are you using? What version of civicrm_multiday_event? What version of PHP?
Comment #4
seascoot CreditAttribution: seascoot commented@coderdan
Understood - these are not fatal errors. I'm running a development site on WAMP with PHP 5.3.13.
As shown in the issue summary/metadata, civicrm_multiday_event is 7.x-1.0-beta7.
Commerce Kickstart 7.x-2.13 uses Drupal 7.27 as core.
MySQL is 5.5.24.
Comment #5
seascoot CreditAttribution: seascoot commentedI first got these error on a WAMP development site.
I set a completely new install from scratch on a Linux CentOS shared server running php 5.4.29. No data was imported to the database, so it was "clean" apart from setting up modules. Drupal is 7.27, Commerce Kickstart 7.x-2.14, CiviCRM Multiday Event 7.x-1.0-rc1+2-dev, Field collection 7.x-1.0-beta7, CiviCRM 4.4.5.
I got the same set of errors with this new install. I also notice that the event gets saved in CiviCRM with a start date and time of 12/31/1969 08:00AM but the event title in CiviCRM Multiday Event shows as Tue, 09/16/2014 - 15:40 to Tue, 09/23/2014 - 16:40 which is what was entered. I can add two sessions, but attempts to add another create an ajax error "an error occurred while attempting to process system/ajax: cannot read property "drupal" of undefined". If I save and exit, I can go back and manage content to edit the event and add another session, but it has to be done one at a time because the same ajax error shows after the first addition.
Comment #6
bcobin CreditAttribution: bcobin commentedThanks for confirming this - I reported the same behavior in https://drupal.org/node/2228821 but I'm not running Commerce Kickstart, nor have I tried to add additional events before fixing the faulty event.
I'm running the module on several installations and the main differences I can think of would be PHP version and Civi 4.4.5 - I've already tried both PHP 5.3.13 and 5.4 - no joy.
Here's hoping this can be tracked down - as per my original post, I've resigned myself to handling new events myself (and dealing with the errors) until the problem is solved. I can't let clients see this.
Thanks to all and good luck!
Comment #7
seascoot CreditAttribution: seascoot commentedI think I've tracked down the AJAX error. I have the event body field set to Full HTML so that I can format the description using the WYSIWYG module with CKEditor set in the profile. When I disable the WYSIWYG module the AJAX issue relating to adding additional session dates disappears.
There is a similar issue reported here related to WYSIWYG/CKeditor #2243413: Error when adding field items - Add another item and also here for WYSIWYG #1757684: Ajax error on Add another item. Applying patch #28 from the latter did not fix the problem.
The undefined index/array_flip issues still remain unresolved.
Comment #8
seascoot CreditAttribution: seascoot commentedThanks to bcobin as posted in www.drupal.org/node/2228821 there is a work-around for this by rolling back Field Collection beta 7 to beta 5.
Comment #9
coderdan CreditAttribution: coderdan commentedI was able to re-produce the errors. The problem is the way civicrm_multiday_event is checking the dates of the sessions. Field Collection changed the node attached data structure dramatically (in a good way); the entire FC related entity is now available in the node data. This will eliminate the need to do a field_collection_item_load() in the middle of CME processing.
The reason that the CiviEvent gets created with a Jan 01 1970 date is because Civi uses the Unix epoch for event dates that are set to NULL due to CME being unable to correctly find the original entities.
A patch is in the works.
Comment #10
coderdan CreditAttribution: coderdan commentedAfter getting into the code a bit more and doing some debugging, I realized that my conclusion was essentially correct but my logic in reasoning it out was flawed. What is happening is that Field Collection is saving the node along with the form submission. Due to this we are entering into the hook_node_presave function twice for each node being saved in the UI. When the FC is saving the node, it attaches in the entire FC entity to the node object instead of going through the Field API to format the field values.
I have run into this issue when doing a CME Migration, so patching this up will be that much more useful.
Comment #12
coderdan CreditAttribution: coderdan commentedFix has been added to the latest 7.x-1.x branch of CiviCRM Multiday Event. Please try out the latest dev version and let me know if your problems are resolved.
Comment #14
kreynen CreditAttribution: kreynen commentedComment #15
coderdan CreditAttribution: coderdan commentedComment #16
kreynen CreditAttribution: kreynen commentedThis is why developers should move issues to "Needs Review" instead of "Fixed" themselves. The latest commit had a PHP error.
http://cgit.drupalcode.org/civicrm_multiday_event/tree/civicrm_multiday_...
Not sure if the intent there is $end_entity = end($node->field_civicrm_multiday_session[LANGUAGE_NONE]); or $end_entity = end($node->field_civicrm_multiday_session[LANGUAGE_NONE]['entity']);, but what was committed obviously isn't right.
Comment #17
coderdan CreditAttribution: coderdan commented@kreynen - the code works perfectly fine for me. My guess is that I'm running a more current version of Field Collection (7.x-1.0-beta7). Could you confirm this?
Comment #18
coderdan CreditAttribution: coderdan commentedComment #19
coderdan CreditAttribution: coderdan commentedI am unable to reproduce the problem with Field Collection 7.x-1.0-beta5. If I could see a var_dump or dpm() of your $node->field_civicrm_multiday_session value, that would be awesome.
Note that I'm working on a fresh D7 core build, not a starter kit.
Comment #20
kreynen CreditAttribution: kreynen commentedI am able to enable the module on Pantheon where they run PHP 5.3.17, but this code results in a PHP parse error at the syntax level on other servers.
This isn't an issue with the version of field_collection or the use of a distribution. The PHP parser on these servers doesn't believe that end($node->field_civicrm_multiday_session[LANGUAGE_NONE])['entity'] is valid PHP.
We never get far enough to check the change in the logic in the update.
When a site running on PHP 5.3.3 upgraded to the dev snapshot that included this change and the module was already enabled, it WSOD the entire site. When I try enabling the module on a clean site running 5.3.14, I get the same error...
Parse error: syntax error, unexpected '[' in ...sites/all/modules/civicrm_multiday_event/civicrm_multiday_event.module on line 366
On a clean site, the module never enables.
I've tried disabling APC. No difference.
I can get the site to work/module enabled if I chance the code at line 366 to...
But I'm not sure that's the same intent as end($node->field_civicrm_multiday_session[LANGUAGE_NONE])['entity']. If it is, I suggest we change to that vs. trying to figure why specific versions of PHP throw a parse error.
Comment #21
coderdan CreditAttribution: coderdan commentedI believe the problem is with versions of PHP earlier than 5.4.10. I was able to reproduce the WSOD by switching to PHP 5.3.20. Seems PHP 5.4 thinks more like I do than does PHP 5.3.
Let me know if this patch helps.
Comment #22
seascoot CreditAttribution: seascoot commentedJust an FYI. I am hosted on a server running PHP 5.4.29 and I do not see the problem Kreynen noted when running the dev version. The dev version also allowed me to update Field Collection to beta 7 without producing the originally reported errors.
Comment #23
stefanwray CreditAttribution: stefanwray commentedOn channelAustin's live community site I upgraded to the latest dev snapshot for this module which included the commits referenced in this issue.
I'm changing the status.
Comment #25
kreynen CreditAttribution: kreynen commented@seascoot can you test the latest dev snapshot and make sure this works for your version of PHP as well? I've tested it on a few different configurations and think we're ready to roll a new release.
Comment #26
kreynen CreditAttribution: kreynen commentedComment #27
seascoot CreditAttribution: seascoot commented@kreynen
I'm pleased to report that I've been running that snapshot for 3 days now on the same server without issues.
Comment #28
synchlayer CreditAttribution: synchlayer commented