Download & Extend

Use of $form_state['storage'] to hold a string/integer (as opposed to an array)

Project:Bibliography Module
Version:6.x-1.4
Component:Code
Category:bug report
Priority:critical
Assigned:Unassigned
Status:active

Issue Summary

Using $form_state['storage'] to store the biblio_type ID results in a "White screen" error with other modules that are expecting $form_state to be an array. The supplied patch fixes this.

AttachmentSize
biblio.module.patch1.31 KB

Comments

#1

Apologies, the original patch wasn't quite right.

AttachmentSize
biblio.module.patch 1.33 KB

#2

Just out of curiosity, which other module triggered this error?

#3

Previous patch resulted in the user being returned to the node edit form once a new biblio node was submitted. The included patch should fix this issue.

EDIT: It was the BATax module (one I wrote myself).

AttachmentSize
biblio.module.patch 1.42 KB

#4

Hi Simon,

Perhaps a cleaner approach, and what I'll probably do, is create a $form_state['storage']['biblio'] array, with elements called "type", "paste" and "doi".

It's certainly not obvious from the documentation (what little there is) that $form_state['storage'] must be an array, but I guess it's not surprising.

Ron.

#5

Status:active» fixed

I've committed the fix for this in the -dev version.

Ron.

#6

Thanks Ron.

#7

Status:fixed» closed (fixed)

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

#8

Status:closed (fixed)» active

Sorry Ron, I'll have to reopen this issue - I guess I didn't properly follow up on this when I first opened it.

I'm afraid the unsetting of all $form_state['storage'] values on line 1454 is breaking any other module that relies on the $form_state['storage'] array during their submit function. You should only unset values that you have (or could have) set.

The included patch fixes this.

[EDIT]

And yes, what you say in #4 is almost definitely a good idea.

AttachmentSize
biblio.module.patch 922 bytes

#9

Good point, I'll include that in future releases.