Skip Navigation

[Gelöst] Conditional not working when checking for blank inputs

Dieser Thread wurde gelöst. Hier ist eine Beschreibung des Problems und der Lösung.

Problem: Conditionals do not appear to be working correctly when testing for blank inputs.

Solution: There is currently a known issue with complex conditional parsing and large content templates in certain versions of PHP 7. You can add the following line to your wp-config.php file to get around this issue:

ini_set('pcre.jit', false);
This support ticket is created vor 6 Jahren, 6 Monaten. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Heute stehen keine Supporter zur Arbeit im Werkzeugsatz-Forum zur Verfügung. Sie können gern Tickets erstellen, die wir bearbeiten werden, sobald wir online sind. Vielen Dank für Ihr Verständnis.

Sun Mon Tue Wed Thu Fri Sat
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

Dieses Thema enthält 2 Antworten, hat 2 Stimmen.

Zuletzt aktualisiert von anthonyB-6 vor 6 Jahren, 5 Monaten.

Assistiert von: Christian Cox.

Author
Artikel
#841203

I am trying to: use a condition - if not blank/empty, then show this field.

Link to a page where the issue can be seen: versteckter Link

I expected to see: This paragraph:

"Disclosure of your information to third parties: only to the extent necessary to run our business, to our service providers, to fulfil any contracts we enter into with you. " should now be reading: "Disclosure of your information to third parties: only to the extent necessary to run our business, to our service providers, to fulfil any contracts we enter into with you these are some other reasons for disclosure....".

Here are the tests I have run to confirm this bug:

1) simply used the field as is. When the field was blank, there was no extra text, when populated it showed up correctly.
2) Tried to use the straightforward conditional: [if {fieldname-value} ne '' evaluate true] then show the field. This didn't work - nothing shows despite the field still being populated from the previous test
3) Tried to use the inverted conditional: [if {fieldname-value} eq '' evaluate false] then show the field. Again, nothing shows.

Here is a video of this test: versteckter Link

This is a very basic function, I can't understand why it's causing me a problem. Please could you get back to me asap as it's holding up a very urgent project.

#843756

Hi, I'll be glad to take a look. There is a known issue that occurs in certain versions of PHP when there is a lot of content and conditionals a Content Template. As a test, can you temporarily delete everything in this Content Template except this:

<strong>Disclosure of your information to third parties:</strong> only to the extent necessary [types field='disclosure-to-other-third-parties-reasons-for-disclosing-information-to-third-parties' separator=', '][/types][wpv-conditional if="( $(wpcf-disclosure-to-other-third-parties-other-reasons) eq '' )" evaluate="false" ] and [types field='disclosure-to-other-third-parties-other-reasons' output='raw'][/types][/wpv-conditional].

If the problem is resolved, revert the changes you made to the Content Template and add the following line to your wp-config.php file:

ini_set('pcre.jit', false);

Please let me know the results of these tests.

#900342

Although removing all code besides the lines suggested meant that the error no longer appeared anyway, when I added all my code back the error still showed. However, I added the line suggested to my wp-config file and it's fixed my issues.

Thank you.