Skip Navigation

[Resolved] Views gives Parse Error unexpected T_FUNCTION on section-content.php, line 97

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

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 17:00 9:00 – 17:00 9:00 – 17:00 9:00 – 17:00 9:00 – 17:00 -
- - - - - - -

Supporter timezone: Europe/Athens (GMT+03:00)

Tagged: 

This topic contains 3 replies, has 3 voices.

Last updated by Juan 7 years, 7 months ago.

Assisted by: Konstantinos.

Author
Posts
#436035

I am trying to: Use views

I visited this URL: hidden link

I expected to see: the wordpress dashbord

Instead, I got: Parse error: syntax error, unexpected T_FUNCTION in /var/sites/a/anthea.crunchnet.co.uk/public_html/wp-content/plugins/wp-views/inc/ct-editor/section-content.php on line 97

#436037

So, what I have done is change this:

add_action( 'wpv_ct_editor_sections', function() {
    $editor_select = apply_filters( 'toolset_user_editors_backend_html_editor_select', '' );
    $content = apply_filters( 'toolset_user_editors_backend_html_active_editor', false );
    if( $content ) {
        wpv_ct_editor_render_section(
            __( 'Template', 'wpv-views' ),
            'js-wpv-content-section',
            $editor_select . $content,
            true,
            '',
            '',
            array( 'section' => 'content_section', 'pointer_slug' => 'ptr_section' )
        );
    }
}, 20 );

to this:

/* ************************************************************************* *\
        Render section content
\* ************************************************************************* */

add_action( 'wpv_ct_editor_sections', 'my_wpv_ct_editor_sections', 20 );

function my_wpv_ct_editor_sections() {
    $editor_select = apply_filters( 'toolset_user_editors_backend_html_editor_select', '' );
    $content = apply_filters( 'toolset_user_editors_backend_html_active_editor', false );
    if( $content ) {
        wpv_ct_editor_render_section(
            __( 'Template', 'wpv-views' ),
            'js-wpv-content-section',
            $editor_select . $content,
            true,
            '',
            '',
            array( 'section' => 'content_section', 'pointer_slug' => 'ptr_section' )
        );
    }
}

This is not a permanent fix, of course, but it is working. Are you going to implement this change (or similar) in your plugin?

#436057

Hi Steve, I managed to reproduced the issue. I assume you're using PHP 5.2.

I am glad to see that you managed to handle the issue.
It will be fixed in the next version of Views anyway and we will also provide an errata entry for this.

Thank you,
Konstantinos

#436728

Juan
Supporter

Timezone: Europe/Madrid (GMT+02:00)

Hi Steve

Thanks for the input, we crafted an errata, and we used basically the same kind of solution that you shared:
https://toolset.com/errata/error-thrown-using-php-5-2/

However, I would like to point out thet we raised the minimum requirements for Toolset to 5.3 some months ago:
https://toolset.com/toolset-requirements/
We still include tests against 5.2 in our schedules, although this issue went under our radar. That means that besides this small one, everything else should be 5.2 compaible. But in the future this could change, and as we plan to include more and more advanced and complex features, we might need to indeed raise the bar a little to 5.3 minimum.

I am pointing this out here in case you need to take some action on your side. You already know that 5.2 has been long enough as an insecure, unmantained branch for PHP, and we all need to make a small effort to finally get to more current versions.

Hope it helps.

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.