ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Comment causing Unexpected String Error

March 23, 2012 12:14pm

Subscribe [3]
  • #1 / Mar 23, 2012 12:14pm

    alara

    4 posts

    Had an odd issue this morning from a client, they approved a comment and when they went to the post to read the comment, they are instead greeted with the following error message:

    Parse error: syntax error, unexpected T_STRING in /path/to/expressionengine/libraries/Functions.php(659) : eval()'d code on line 49

    I switched the comment back and the entry loads fine again. I’ve looked through the comment, it doesn’t seem to contain any special characters and was written by someone the client knows, so it isn’t spam. The client found (don’t know how) that if he put a period at the end of the last sentence in the comment, it worked fine. While this may be an acceptable fix this one time, I’m not certain it won’t happen again. Any ideas?

    I’m running EEv2.4.0 - Build: date 20120123 and I’m calling the comment with the {comment_stripped} tag.

  • #2 / Mar 25, 2012 9:07am

    Sean C. Smith

    3818 posts

    Hi alara,

    That is indeed unusual. Could you post up the content of the comment that caused the problem. I’d like to see that so I can test on my sandbox install. Also the code for your comment listing.

    Sean

  • #3 / Mar 28, 2012 11:58am

    alara

    4 posts

    Sorry, I was out of town unexpectedly. Here is the comment:

    Hi Thad, well done on your history of this site. I, like you, don’t agree with the name because it obviously is not the ‟FIRST‟. There are many Internet Chuches. However if that is the name the LORD gave you & it was confirmed, then all you can do is trust & obey.
    Wendy and I attend 2 Internet churches on Sunday and they are “live” “real time” churches. One is FourWinds Mission church which is streaming live and has a chat room where you can fellowship with others who are virtually attending the service. FourWinds is an Anglican styled church and Brian Hardin who does the dailyaudiobible podcast is the Priest or Father or Pastor which ever you prefer.
    The other is a Skype church called Solid Rock San Jose in San Jose Calif. That is a teaching type of church which actually Darla and I’s second cousin John Goodwin is the Pastor/Teacher. Since that church is on Skype we can actually interact with the people there live in real time.
    So I am attending “church” most of the day on Sundays. And I really look forward to it.
    Your format is a good one for people who want to really get in there and study the Scriptures and I will be reading some of your lessons now that Darla has informed me your site is up and running again. I like the “plain and simple” look the ones with all the graphics and rotating links I find distracting.
    K.I.S.S. Keep It Simple Saints.
    That is great that the Lord is speaking to your heart. He is a loving God and He does want to dialogue with us.
    I have come to believe that the Kingdom the Lord mainly came to destroy is the Kingdom of Man’s Religion!
    I, like you, have been in church all my life but never really felt “connected” to God. Until I got the “baptism of the Holy Ghost” and started speaking in tongues that is when I really “felt” a connection with God a personal connection. I felt like He really does KNOW me and really DOES want to speak to me and with me.
    I have since come to believe that the whole charismatic movement is not of the Lord but I am still grateful for that experience in my life. It changed forever the way I relate to the Lord.
    Thank you for being obedient to the Lord and going ahead with this vision the Lord has given to you.
    God Bless all your efforts.
    Joe Dan

    And here’s the code:

    <div class="comments">
         {exp:comment:entries sort="desc" orderby="date" limit="10" paginate="both"}
          {if total_pages > '1'}
          {paginate}
                 Page {current_page} of {total_pages} pages {pagination_links}
          {/paginate}
          {/if}
         <div class="comment well">
          <strong>{if url}<a href="http://{url}">{name}</a>{if:else}{name}{/if}</strong> - <?=nl2br('{comment_stripped}')?>
          
           {comment_date format="%F %j, %Y - %g:%i %a"}{if location} From {location}{/if}
          
         </div>
         {/exp:comment:entries}
        </div>
  • #4 / Apr 02, 2012 4:20pm

    Shane Eckert

    7174 posts

    Hi alara,

    I gave your comment a try in my own setup and it works just fine.

    Can you try getting rid of <?=nl2br(’{comment_stripped}’)?> and see what happens?

    In fact, can you create a new template and just call the comments and see what happens? I am not sure why this is happening so I would like to rule out the extra PHP.

    Please let me know what you see.

    Cheers,

  • #5 / Apr 02, 2012 6:10pm

    alara

    4 posts

    Thanks for the reply Shane. It does not have the issue when the nl2br() is taken out. However, this does render the comments all on one line, which is not quite what I need, but I can make it work. Not sure why it would break on that particular tag, any thoughts?

  • #6 / Apr 05, 2012 12:20pm

    Shane Eckert

    7174 posts

    Hey alara,

    I do not know why it would break on that tag. :-(

    Is there a reason you call comments with stripped?

    Cheers,

  • #7 / Apr 05, 2012 12:27pm

    alara

    4 posts

    I have the comments inline with the commenters name. Not a big deal, since that’s the problem, I just moved it. Just curious as to why the nl2br tag would break on that particular comment.

  • #8 / Apr 06, 2012 3:58pm

    Robin Sowell

    13255 posts

    It looks like it’s hitting a single quote and then it’s basically nl2br(‘this is my string it’s going to cause a problem’).  Make sense?  So yes- that tag is basically just outputting the full contents between your single quotes, and if the contents contain a single quote… error.

    Just the {comment} tag looks like it would work in this case, which is probably how I’d go.  Though I suspect something more may have been in play.

    Still need some brainstorming on this one, or is it looking good?

  • #9 / Apr 06, 2012 4:12pm

    glenndavisgroup

    436 posts

    Would this not work?

    <?=nl2br("{comment_stripped}")?>

    Change the single quotes to double instead.

    Mike

  • #10 / Apr 09, 2012 3:58pm

    Shane Eckert

    7174 posts

    Hey alara,

    How are things? Does Robin’s explanation make sense?

    Cheers,

  • #11 / Apr 18, 2012 2:39pm

    alara

    4 posts

    So sorry, the email tied to this account is shared and I just saw the responses. Robin’s explanation makes sense, thank you very much!

  • #12 / Apr 19, 2012 1:42pm

    Shane Eckert

    7174 posts

    Hello alara,

    Glad to hear it!!

    If you need anything else, please just let us know by opening a new thread.

    Cheers,

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases