Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 971879
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T03:02:04+00:00 2026-05-16T03:02:04+00:00

I have a eval function like this if(FALSE === @eval($code)) echo ‘your code has

  • 0

I have a eval function like this

if(FALSE === @eval($code)) echo 'your code has php errors';

So if the code has synthax errors it will return that message.

The problem is that if within the code you have something like:

  require_once('missing_file.php');

it will just break the page, without my nice error message 🙁

Is there any workaround for this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T03:02:05+00:00Added an answer on May 16, 2026 at 3:02 am

    Well, first I hope that $code comes from a trusted source and that you’re executing arbitrary code sent by the users.

    Second, the only way I see you can workaround that is to save $code into a file, run it with the command line PHP interpreter, and check the exit value. Note that passing this test doesn’t make $code fatal error free, it just so happened that this particular execution of the script did not throw any fatal error; there may be other code paths that trigger such an error.

    This is because once eval triggers a fatal error, it can’t be recovered and the script dies. eval only returns FALSE if there is a parsing error.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an ascx that uses Eval in a repeater like this: <%@ Control
Hi I have a Linq CodeBehind Function Like this var result = from m
How can I get a Javascript file to minity like this? eval(function(p,a,c,k,e,d){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--){d[e(c)]=k[c]||e(c)}k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1};while(c--){if(k[c]){p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c])}}return
My question is regarding JavaScript Closures and the Eval() function. I have some code
I've often heard the argument (in javascript, but many languages have an eval-like feature)
I have some lisp initialisation code: (eval-when (:compile-toplevel :load-toplevel :execute) (require 'asdf)) (eval-when (:compile-toplevel
Tcl 8.4. I have this namespace tree: namespace eval menu_tree { #-------------------------------------------------------------------------- ## Main
I have a listview like this : <telerik:RadListView ID=rlv_available_sys runat=server ItemPlaceholderID=sys_holder DataKeyNames=process_id OnItemDataBound=rlv_available_sys_ItemDataBound> <ItemTemplate>
I have a datalist like this: <asp:DataList ID=dl runat=server Width=301px onitemcommand=dl_ItemCommand> <ItemTemplate> <table style=border:solid
For example in my datalist if Eval(OptionJ).Tostring = Null I would like the function

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.