Skip Navigation

[Resolved] wpv-postexcepts – returning null on id after upgrade to PHP 7.1.11& Views v2.6

This support ticket is created 6 years, 4 months ago. 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.

Sun Mon Tue Wed Thu Fri Sat
- - 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00
- - - - - - -

Supporter timezone: Asia/Ho_Chi_Minh (GMT+07:00)

Tagged: 

This topic contains 3 replies, has 2 voices.

Last updated by Beda 6 years, 4 months ago.

Assisted by: Beda.

Author
Posts
#916769
Screen Shot 2018-06-22 at 2.01.23 PM.png

After a recent upgrade to PHP 7.1.18, WP v4.9.6 and running Toolset Views 2.6. We are not seeing excerpts.
After looking at debug, it looks query results returns the excerpts but wp-post-excerpt is returning null.

We are seeing nothing in php logs.

Tried passing id directly in loop editor with no success. Also disabled all plugins and switched to default theme with same isssues

Here is an example:
hidden link

query
post_excerpt] => With the debut of the College of Arts and Sciences’ new website, we also debut our new tag line: Synergy Unleashed. At Carolina, teaching, learning and research are transformative processes by which we invent a better future. There is synergy in pairing diverse and sometimes unexpected disciplines.

shortcode
Attributes: {"item":null,"id":null,"post_id":null,"length":"20","count":"word","more":null,"format":"autop","output":"formatted"}
Info: Data received from cache

Thank you!

#916902

Excerpt ShortCodes work fine on my local install with those same configurations.
This may be due to some hidden PHP error, can you enable WP Debug and let me know the exact error if there is any?
https://codex.wordpress.org/WP_DEBUG

If the issue persists on your install after using only Toolset and a native WordPress theme, and you inserted the Toolset ShortCode with the GUI (is not malformatted), then we will probably need to take a look at the site locally.

Can you add a copy of the site, in case you cannot see any PHP error on above steps?
https://toolset.com/faq/provide-supporters-copy-site/

Thanks!

#917635

I found the issue. In your docs you have this as an usage example for wpv-post-excerpt, but that will return Warning: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead. Should be updated for PHP 7

//Remove any {{caption}} shortcode that the excerpt might include, mainly if it is being taken from the post content:
add_filter('wpv_filter_post_excerpt', 'prefix_strip_captions');
function prefix_strip_captions($excerpt) {
    $excerpt = preg_replace('#([[]caption)(.*)([[]/caption[]])#e', '', $excerpt);
    return $excerpt;
}
#917846

Thanks for this hint. I replicated this issue and can confirm that on PHP 7+ that error will happen.

You will need to call preg_replace_callback () and create a custom call back that returns the replacement string.

We will update that DOC and eventually include a better, PHP 7 compatible example.

This is however not a BUG in Toolset, as the Filter still works.
The filter just allow you to hook your custom code (as example, a preg_replace_callback) to the right moment of the View's "life".

We however need to ensure that the examples provided are working in all cases.