Forums

[Plugin: Exec-PHP] Shows PHP Code on Non-Homepage Post Listings (4 posts)

  1. WebGeek
    Member
    Posted 5 months ago #

    I found a bug that I'm not sure if it's always been there or just showed up in 2.8. When you see the list of posts on your blog homepage it's fine, but when you click to page 2,3,4, etc of the listings, the PHP code is exposed and not executed. When you click through to the actual post, it's fine.

    This is also a potential security risk.

    http://wordpress.org/extend/plugins/exec-php/

  2. mmorpglife
    Member
    Posted 4 months ago #

    I had the same problem. This seems to be caused by one of Wordpress' native functions force_balance_tags. This function worked before as well on the content of your blog but for some reason exec-php executed before this filter. In any case, the way I resolved it is I added these lines to exec-php file /include/runtime.php function filter_user_content($content).

    if(strpos($content,'< ?php ')!==FALSE)
    	{
    		$content=str_replace('< ?php','<?php',$content);
    	}

    Now it executes the code properly. The problem with this approach is that once you upgrade exec-PHP and they do not include this fix or provide another one for this particular problem you will again have this nasty bug. I resolved this by making a small plugin of my own called my-fixes.php. Put it in the plugins folder. and has this code in it:

    add_filter('the_content', 'my_filter_php_tag', 0); //fix for exec-php plugin and wordpress 2.8 and messed up php tag
    
    function my_filter_php_tag($content)
    {
    	if(strpos($content,'< ?php ')!==FALSE)
    	{
    		$content=str_replace('< ?php','<?php',$content);
    	}
    	return $content;
    }

    Hope this helps...

  3. serviendo
    Member
    Posted 1 month ago #

    This worked for me, many thanks mmorpglife.

    This was only happeningon one of my blogs - the other 2 were fine. Settings were the same too. Odd how these things happen!

  4. then2s
    Member
    Posted 4 days ago #

    AWESOME! The fix worked for me perfectly! I'm using you fix at http://TheN2S.com

    Here was my problem: http://wordpress.org/support/topic/333634?replies=1

Reply

You must log in to post.

About this Topic

Tags