Closed (fixed)
Project:
mothership
Version:
7.x-2.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
27 Sep 2012 at 14:31 UTC
Updated:
20 Aug 2013 at 14:01 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
Anonymous (not verified) commentedI tested this, your fix works.
Comment #2
jessepinho commentedIf I may be picky:
if (!empty($element['#required'])) {would be better, since $element['#required'] could be set, but set to
FALSE.Comment #3
yatil commentedI think both solutions alter the meaning of the statement:
Let’s say
$element['#required'] = TRUEthenIf
$element['#required'] = FALSEIf
$element['#required']is not setmost sensitive code is imho
Comment #4
jessepinho commentedyatil: Your middle example, where $element['#required'] = FALSE, is incorrect about the return value of !empty(). If something is set to FALSE, empty() returns TRUE. Since a negation operator (an exclamation mark) is placed before empty(), it will instead return FALSE—not TRUE, like you wrote.
Comment #5
yatil commentedRight, I was wrong :-)
Comment #6
gagarine commented#2 is the right way.
Comment #7
mojzis commentedadding a patch for #2 :)
Comment #8
GemVinny commentedThanks for patch - had to change line numbers but apart from that it worked for me.
Gem
Comment #9
zeropx commentedTested and can validate this as a fix.
Updated Mojzis's patch #7 with a small spelling fix on the word "required" it was "reguired" before :P
Comment #10
jessepinho commentedDoesn't look like it was a G to me...?
EDIT: Oh, in the comments. My bad.
Comment #11
zeropx commentedOops did that bad. :D Still fresh to this. Sorry.
Hopefully this one is right.
Comment #12
derhasi commentedThis is already fixed in the current dev (since september): @see http://drupal.org/commitlog/commit/9436/bc33b09712e38e3e93b496a39014c458...
Comment #13
zeropx commentedGood catch, forgot to check Dev. :D Still spelled "required" wrong though with it stil "reguired" hehe
Comment #15
jamiehollernThis issue is not fixed as of 7.x-2.10. The simple patch in #7 is the correct way to deal with this.
Although this isn't a big issue, Drupal coding standards dictate PHP should be E_ALL compliant and this causes issues for inexperienced site builders who don't know how to deal with the notice messages.
Comment #16
jamiehollernComment #17
mcrittenden commented@jamiehollern is correct, the issue has re-appeared due to this line:
That line should be rewritten like so:
Comment #18
mortendk commentedplease test the latest dev version - "works on my machine" ;)
Comment #19
mcrittenden commentedFixed by this commit. Thanks!
Comment #20.0
(not verified) commentedReplace
with