This is a discussion on Re: error-logs() bug ?? within the PHP Language forums, part of the PHP Programming Forums category; yaaros@gmail.com wrote: > Hello !! I have a problem with error_logs. The problem is in this > code: > &...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
yaaros@gmail.com wrote:
> Hello !! I have a problem with error_logs. The problem is in this > code: > > $id_tmp = $_REQUEST["id"]; > if(!isset($id_tmp) && empty($id_tmp)){ > invalidArgs(); > echo "buug"; > } > > I'd like to check if the variable id is passed by GET method to the > script. If not, function invalidArgs() will start. > In function invalidArgs() I thrown exception InvalidArgsException. I > set a handler for whole script to manage exceptions using > set_exception_handler(); function. I write, by error_log, errors to > file and show warning page that the parameter id isn't pass through. > > And the problem is that when I open this page in www browser IE6 and > put correct parameter id everything is ok, the page that suppose to is > showing but in file where errors are written (by error_logs), are > appeared errors of InvalidArgsException ?? That's really weird > because the script doesn't suppose to get into if-block and start > function invalidArgs(). What is wrong, why error_log writes an errors > that doesn't suppose to ?? Everything work correct, the page and the > rest of the script acts like it gets the id parameter from GET > methods, but there is entry in error_log file ?? > That is correct. $id_tmp = $_REQUEST["id"]; will log a notice if $_REQUEST["id"] is not set. You should be checking it directly instead of setting $id_tmp. -- ================== Remove the "x" from my email address Jerry Stuckle JDS Computer Training Corp. jstucklex@attglobal.net ================== |
|
|||
|
I found the reason why is errors written in log file but I still don't
understand that :). Before in the code I have got an img tag which was written like that: <img src="?" alt="" width=1 height=1> It have bad src attribute and this causes somehow my problems. When I delete this img tag log file become empty after refreshing pages. Intresting huh ?? I have no idea why this tag causes that the first trown exceptions in code was written in log file but it's true. Maybe somena could explain me that ?? Thanks for yoours answers |
|
|||
|
yaaros@gmail.com wrote:
> I found the reason why is errors written in log file but I still don't > understand that :). > Before in the code I have got an img tag which was written like that: > > <img src="?" alt="" width=1 height=1> > > It have bad src attribute and this causes somehow my problems. When I > delete this img tag log file become empty after refreshing pages. > Intresting huh ?? > > I have no idea why this tag causes that the first trown exceptions in > code was written in log file but it's true. > Maybe somena could explain me that ?? > > Thanks for yoours answers > This is HTML code and wouldn't cause a PHP exception. It would, however, cause an error in the Apache error log relating to the invalid image filename. -- ================== Remove the "x" from my email address Jerry Stuckle JDS Computer Training Corp. jstucklex@attglobal.net ================== |
|
|||
|
..oO(yaaros@gmail.com)
>I found the reason why is errors written in log file but I still don't >understand that :). >Before in the code I have got an img tag which was written like that: > ><img src="?" alt="" width=1 height=1> > >It have bad src attribute and this causes somehow my problems. When I >delete this img tag log file become empty after refreshing pages. >Intresting huh ?? Logical. The URL in the 'src' attribute is empty. When resolving that, the browser starts with the base URL, which is usually the one of the current document unless you use a 'base' element. So in fact requesting the image leads to a second request of the same page, but with an empty query string -> exception. You could also write the content of $_SERVER['REQUEST_URI'] to your error log to see that. Micha |