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.

Better error than just a line Number? Impossible to debug.

February 08, 2012 4:25pm

Subscribe [2]
  • #1 / Feb 08, 2012 4:25pm

    Trend Hunter

    81 posts

    Hey guys,

    We just upgraded our site from 1.7 to 2.3, and now comes the task of going through the code-base and correcting errors that may have come about due to conversion. (i.e. {exp:replace} no longer allowed).

    I did a dry run on a local environment first and had much more success.

    Currently I’m getting errors when viewing pages, but there is no stack trace or anything to help guide me to the problem. The following is a copied example of an error:

    Parse error: syntax error, unexpected T_STRING in /home/location/public_html/system/expressionengine/libraries/Functions.php(656) : eval()‘d code on line 53

    Now Functions.php is the EE functions collection, and line 656 is just a wrapper for php eval(). So “line 53” is where the error is occurring, but where? What template? We have way to many templates to just go through checking them all - any help would be fantastic.

  • #2 / Feb 09, 2012 4:17pm

    Shane Eckert

    7174 posts

    Hello Trend Hunter,

    I am sorry to hear you are running into this problem.

    I have seen this error before, but not exactly. Check out this suggestion.

    Do you have debugging enabled? If not, that may help you pinpoint where the error is coming from.

    To turn debugging on please go to your Control Panel and navigate to Admin->System Administration-> Output and Debugging. Please set the last two settings, which are “Display Output Profiler?” and “Display Template Debugging?”, to yes.

    Visit the page that is giving you the error that you mentioned and there should be more information.

    Let me know if there is anything else I can help you with.

    Cheers,

  • #3 / Mar 09, 2012 2:54am

    vosSavant

    380 posts

    I’d like to jump into this conversation. Maybe it’s just late, but I’m struggling with a similar error. It says simply:

    Parse error: parse error in C:\xampp\htdocs\sitename\system\expressionengine\libraries\Functions.php(656) : eval()'d code on line 16

    What the heck am I to do with that? The worst part is that this error appears intermittently. My template renders, but where some of the content is supposed to appear I get this error (sometimes) instead. I’d love to be able to track it to a specific line number of code in a file, but not sure if that’s possible.

    I’ve turned on debugging but there is nothing in there that looks fishy to me. Any ideas?

    Edit: I managed to troubleshoot the issue, but I’m still curious if there’s a way to pinpoint parse errors like this. Thanks.

  • #4 / Mar 09, 2012 5:43pm

    Shane Eckert

    7174 posts

    Hello vosSavant,

    I am glad you found a resolution.

    I agree, the error is not so helpful and the team is working on improving.

    Would you mind sharing your troubleshooting process? I would love to see that and the community would benefit as well.

    Cheers,

  • #5 / Mar 10, 2012 7:49pm

    vosSavant

    380 posts

    Shane,

    No problem. I was getting that parse error above in a specific section of my rendered template, so I was able to zero in on which snippet contained the problematic code. The hardest part about troubleshooting is that the parse error only showed up about 15% of the time (about 1 in 6 page loads).

    By removing chunks of code and reloading the page a bunch of times, I was able to isolate this as the problem in my snippet:

    {if author_id == '{snippet:memberid}'}...{/if}

    The snippet was calling a snippet that had this code:

    <?php echo $this->EE->session->userdata['member_id']; ?>

    By simply replacing {snippet:memberid} in the first snippet with the actual PHP code, I was able to resolve the problem. I.e., the corrected code in my first snippet is now:

    {if author_id == '<?php echo $this->EE->session->userdata['member_id']; ?>'}...{/if}

    Please correct me if I’m wrong, but my takeaway from this is that parse order was rendering the snippets in the expected order most of the time, and that calling a snippet within a snippet can have unpredictable results.

  • #6 / Mar 12, 2012 1:22pm

    Shane Eckert

    7174 posts

    Hey Ryan,

    Snippet in a snippet is not a good idea, you are right. That was probably your issue. Parse order can get tricky especially with nesting embeds and snippets.

    Thanks for posting your results in. I appreciate it.

    Is there anything else I can help with?

    Cheers,

  • #7 / Mar 12, 2012 4:09pm

    vosSavant

    380 posts

    Hi Shane, thanks for getting back. Nope, nothing else needed here, thanks!

  • #8 / Mar 12, 2012 4:12pm

    Shane Eckert

    7174 posts

    Hey Ryan,

    Glad to hear it!

    Have a great week.

    Cheers,

  • #9 / Mar 12, 2012 4:12pm

    Shane Eckert

    7174 posts

    Should probably close the case as well. 😊

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

ExpressionEngine News!

#eecms, #events, #releases