Empty text field returns not empty value.

More
6 months 3 weeks ago - 6 months 3 weeks ago #85235 by lipatovroman
Hello!
I'm not sure when it happened, but I'm sure it's FC bug.
So, I have php condition to check if $this->fields->display is empty.

Code:
if (empty($this->fields['text']->display)) { echo "empty"; } else { echo "not empty"; }


It worked fine for several years.

But today I discovered, completely by accident, when I was browsing the pages of the site, that the description area is blank.
I spent a lot of time trying to figure out what exactly happened.
In the database, the introtext table is empty. But my code wasn't working.
It turned out that $this->fields->display was returning a space.
I'm sure this space is added somewhere in the FC code. It's not in the database.

I edited the code and now everything works.

Code:
if (isset($this->fields['text']->display) && trim($this->fields['text']->display) !== '') { echo "not empty"; } else { echo "empty"; } ?>
 
Last edit: 6 months 3 weeks ago by lipatovroman.

Please Log in or Create an account to join the conversation.

More
6 months 3 weeks ago #85236 by micker

FLEXIcontent is Free but involves a very big effort on our part.
Like the our support? (for a bug-free FC, despite being huge extension) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing reviews. Thanks![/size]

Please Log in or Create an account to join the conversation.

More
6 months 2 weeks ago #85237 by lipatovroman
Thanks for the reply.
Not helps.
I downloaded and install FC from master branch.
Then I added test code:
Code:
echo 'prefix'.$this->fields['text']->display.'suffix';

Note, that description field for test item is empty.

This is how it looks in browser:


And this is code from the browser:



As you can see, there is an extra space between prefix and suffix.
 

Please Log in or Create an account to join the conversation.

More
6 months 2 weeks ago #85246 by micker

FLEXIcontent is Free but involves a very big effort on our part.
Like the our support? (for a bug-free FC, despite being huge extension) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing reviews. Thanks![/size]

Please Log in or Create an account to join the conversation.

Moderators: vistamediajoomlacornerggppdk
Time to create page: 0.480 seconds
Save
Cookies user preferences
We use cookies to ensure you to get the best experience on our website. If you decline the use of cookies, this website may not function as expected.
Accept all
Decline all
Essential
These cookies are needed to make the website work correctly. You can not disable them.
Display
Accept
Analytics
Tools used to analyze the data to measure the effectiveness of a website and to understand how it works.
Google Analytics
Accept
Decline