• I am running a simple while loop in Insert PHP under php 5.6.27.

    [insert_php]
    $x = 1;
    while ($x <= 5) {
    echo $x;
    $x++;
    }
    [/insert_php]

    This yields a php syntax error: Parse error: syntax error, unexpected ‘;’ in /Users/Nonesuch1/Giga/TECH/IOT/nistir/Website/wp-content/plugins/insert-php/insert_php.php(48) : eval()’d code on line 3

    As the syntax is already correct, the error is evidently indicative of something else.

    Looking deeper, with all sorts of debugging enabled, the detail is revealing:

    # Time Memory Function Location
    1 0.0035 239752 {main}( ) …/index.php:0
    2 0.0035 240224 require( ‘/Users/Nonesuch1/Giga/TECH/IOT/nistir/Website/wp-blog-header.php’ ) …/index.php:17
    3 0.0847 3171928 require_once( ‘/Users/Nonesuch1/Giga/TECH/IOT/nistir/Website/wp-includes/template-loader.php’ ) …/wp-blog-header.php:19
    4 0.0981 3409952 include( ‘/Users/Nonesuch1/Giga/TECH/IOT/nistir/Website/wp-content/themes/twentyseventeen/page.php’ ) …/template-loader.php:74
    5 0.1722 3777104 get_template_part( ) …/page.php:27
    6 0.1722 3778024 locate_template( ) …/general-template.php:167
    7 0.1723 3778208 load_template( ) …/template.php:643
    8 0.1723 3791024 require( ‘/Users/Nonesuch1/Giga/TECH/IOT/nistir/Website/wp-content/themes/twentyseventeen/template-parts/page/content-page.php’ ) …/template.php:686
    9 0.1738 3792376 the_content( ) …/content-page.php:22
    10 0.1741 3793600 apply_filters( ) …/post-template.php:240
    11 0.1741 3793992 WP_Hook->apply_filters( ) …/plugin.php:203
    12 0.1743 3797360 call_user_func_array:{/Users/Nonesuch1/Giga/TECH/IOT/nistir/Website/wp-includes/class-wp-hook.php:298}
    ( ) …/class-wp-hook.php:298
    13 0.1743 3797776 will_bontrager_insert_php( ) …/class-wp-hook.php:298

    It would appear that an array value is being returned (or not) to Insert PHP but it cannot be properly interpreted. I thought it might relate to the WP Loop or the theme, but various reconfiguration attempts continue to yield the same persistent error. I still suspect some sort of misconfiguration.

    Quite frustrated well into the second week of troubleshooting.

Viewing 1 replies (of 1 total)
  • Plugin Author WillBontrager

    (@willbontrager)

    Unfortunately, I’m unable to duplicate the issue using php 5.6.10 or php 5.3.29, both WP 4.7. The code runs like it’s supposed to.

    I assume you’re using the “Text” tab and not the “Visual” when editing the post or page.

    My thought is that something is modifying the code before Insert PHP has a go at it.

    To test, deactivate any plugins that might conceivably modify the page or post content or load it more than once, perhaps for scanning before publishing. Examples to test are SEO plugins and wrappers like Visual Composer.

    Will

    • This reply was modified 8 years, 2 months ago by WillBontrager.
Viewing 1 replies (of 1 total)
  • The topic ‘Array link fails in INSERT PHP’ is closed to new replies.