0 not considered valid alternate or empty text

dww - August 11, 2009 - 23:25
Project:Views
Version:6.x-2.x-dev
Component:Code
Category:bug report
Priority:minor
Assigned:dww
Status:needs review
Description

I noticed this while testing #510910: When multiple fields share a column in table view only the last field displays. If you define a "Global: Custom text" field and give it the value "0", that won't show up in your view, apparently due to some render() related special case for rewriting and custom text handling. It's a separate bug from #510910 so I'm opening a new issue for it... Very obscure, so I'm calling this minor for now. ;)

#1

dww - August 12, 2009 - 00:02
Title:Global: Custom text using '0' as the value is not rendered» 0 not considered valid alternate or empty text
Priority:minor» normal
Assigned to:Anonymous» dww

Based on further investigation, we just aren't considering '0' to be valid alternate text nor empty text. Attached patch fixes (and applies cleanly to both DRUPAL-6--3 and HEAD).

AttachmentSize
546586-1.empty_and_0.patch 2.28 KB

#2

dww - August 12, 2009 - 00:08
Priority:normal» minor
Status:active» fixed

From IRC:

merlinofchaos: WFM.

Tested and committed to HEAD and DRUPAL-6--3. Guess this is still minor, even though it's not as minor as I originally thought. ;)

#3

System Message - August 26, 2009 - 00:10
Status:fixed» closed

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

#4

jeffschuler - November 21, 2009 - 18:24
Status:closed» needs review

Backporting this fix to Views 2 did not solve the issue for me.

render()ing the values means that $this->last_render has a string '0' instead of an int 0 -- need to test for this:

-      if ($this->last_render !== 0 || !empty($this->options['empty_zero'])) {
+      if (($this->last_render !== 0 && $this->last_render !== '0') || !empty($this->options['empty_zero'])) {

Patch for 2.x-dev attached. I'm not sure whether this change is necessary for 3.x-dev as well.

btw, #559102: Views thinks that a 0 value is empty even when the box 'Count the number 0 as empty' is unchecked... looks to be a dup of this issue, where folks are still experiencing the issue, (as I was.)

AttachmentSize
546586_0notEmpty-views2_1.patch 1018 bytes

#5

sphopkins - November 23, 2009 - 16:39

I have been posting in the other thread #559102: Views thinks that a 0 value is empty even when the box 'Count the number 0 as empty' is unchecked... and I am glad that someone has some ideas here.

I tested this patch on my machine and I do not thing that it worked. Note that I am using it on views 2.7.

I will post any results here

#6

dashton - December 2, 2009 - 14:34

I'm having the same issue- applied the patch and it didn't fix the problem. I'll keep looking into it and post what I find.

#7

sphopkins - December 16, 2009 - 14:03

Need to verify this but when you apply the patch to 6.2.8 I get a whitescreen....

That and Views 2.8 still does not display '0' at all when this patch is applied (properly as well... for some reason I did not apply it properly hence the whitescreen).

 
 

Drupal is a registered trademark of Dries Buytaert.