WordPress.org

Ready to get started?Download WordPress

Forums

Allow PHP in Posts and Pages
[resolved] Plugin Busted (8 posts)

  1. Bill Weye
    Member
    Posted 1 year ago #

    Your plugin appears to be busted with version 3.4.1 of WP. I'm getting two errors (before and after the php code is output (the tag cloud I wanted was output correctly, despite the php errors).

    The errors were:

    Parse error: syntax error, unexpected $end in /home/weye5/public_html/wp-content/plugins/allow-php-in-posts-and-pages/allowphp.php(110) : eval()'d code on line 3

    and

    Parse error: syntax error, unexpected T_ENDIF in /home/weye5/public_html/wp-content/plugins/allow-php-in-posts-and-pages/allowphp.php(110) : eval()'d code on line 1

    http://wordpress.org/extend/plugins/allow-php-in-posts-and-pages/

  2. Hit Reach
    Member
    Plugin Author

    Posted 1 year ago #

    Hi Bill,

    It could be the code you are using is not using the correct syntax,

    The error is in the evaluating of your code which is the most likely possibility, are you sure the code is correct? :)

    Thanks!

  3. jimsander
    Member
    Posted 1 year ago #

    I am seeing the same since upgrading, but can't say which upgrade (to wp 3.4.2 or upgrading the plugin)

    Code

    [php]
    if ( 1 == 1 ) {
    [/php]
    this is one
    
    [php]
    } else {
    [/php]
    
    this is two
    
    [php]
    }
    [/php]

    Output

    Parse error: syntax error, unexpected $end in /mnt/target07/350037/589494/www.rapidresultspersonaltraining.net/web/content/wp-content/plugins/allow-php-in-posts-and-pages/allowphp.php(373) : eval()'d code on line 3
    
    this is one
    
    Parse error: syntax error, unexpected '}' in /mnt/target07/350037/589494/www.rapidresultspersonaltraining.net/web/content/wp-content/plugins/allow-php-in-posts-and-pages/allowphp.php(373) : eval()'d code on line 2
    this is two
    
    Parse error: syntax error, unexpected '}' in /mnt/target07/350037/589494/www.rapidresultspersonaltraining.net/web/content/wp-content/plugins/allow-php-in-posts-and-pages/allowphp.php(373) : eval()'d code on line 2
  4. Hit Reach
    Member
    Plugin Author

    Posted 1 year ago #

    Hi Jimsander,

    Way to hijack!

    if you are not using the advanced filter then you cannot break apart your code like that as its being evaluated individually, its the equivalent of creating a new php file with only the contents:

    <?php
     if ( 1 == 1 ){

    which would cause an error anyway.

    Thanks
    Hit Reach

  5. sazanetti
    Member
    Posted 1 year ago #

    getting this error message:

    Parse error: syntax error, unexpected '<' in /home/content/97/8218197/html/wp-content/plugins/allow-php-in-posts-and-pages/allowphp.php(191) : eval()'d code on line 1

    from this [allowphp function=1]

    <?php
    if ( is_user_logged_in() ) {
    echo 'Welcome, registered user!';
    } else {
    echo 'Welcome, visitor!';
    }
    ?>

  6. yosh
    Member
    Posted 1 year ago #

    @sazanetti

    all snippets automatically start with <?php

    Try it with that removed.

  7. xehyundai3s
    Member
    Posted 1 year ago #

    I used this code:

    <?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('home_sidebar_products') ) : ?><?php endif; ?>

    I converted this to [php]code[/php]

    but it display same error abow. Please help me to fix this?

  8. AaronRobeson
    Member
    Posted 12 months ago #

    Old thread but I figured I'd post my fix in case someone else finds it.
    I was getting the:
    /wp-content/plugins/allow-php-in-posts-and-pages/allowphp.php(110) : eval()'d code on line 3
    error
    with the code:

    [php]
    $result = mysql_query("SELECT Id,Name FROM recipes");
    if (!$result) {
    echo 'Could not run query: ' . mysql_error();
    exit;
    }
    $row = mysql_fetch_row($result);
    
    echo $row[0]; // 42
    echo $row[1]; // the email value
    [/php]

    I replaced the code with:

    [php]
    echo 'hello world';
    [/php]

    it echoed properly and when I replaced hello world with the original code it worked.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.