Jump to content

Weird Question, Can I modify a php command?


jscix

Recommended Posts

I'm not sure if this is possible, but what I'm curious about is,

 

Is it possible to modify/redefine how a php command such as DIE works?

 

What I would like to do is have the die command also save the text to a log file, is this possible ?

 

eg:

 

die ("Error",$logfilename);

 

anyone? ::o

Link to comment
Share on other sites

You can change the way how die works if you wish. However you will need to know C (or what ever programming language PHP is programmed in).

 

However what I'd do is create a function that will log the error passed to it example

die(log_error('error message here', $errorLog);

Link to comment
Share on other sites

ah that is a really good idea. Thank you wild.

 

The reason I asked is I have already done a large amount of work, before deciding that logging errors would end up saving me a whole lot of work later on when something goes wrong/breaks.. So being lazy as I am, I wanted a quick fix so I didn't have to replace all the die commands with a modified version. :/

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.