You are here: Re: [PHP] Catch warnings « PHP « IT news, forums, messages
Re: [PHP] Catch warnings

Posted by Mariano Guadagnini on 11/16/05 15:55

Curt Zirzow wrote:

>On Tue, Nov 15, 2005 at 04:39:05PM -0300, Mariano Guadagnini wrote:
>
>
>>Hi, i�m writting a php program that parses and saves some xml files on a
>>server. The problem is that i want to catch warnings so as to be able to
>>store them in a variable, but not to be put directly on client�s
>>browser. I got the following code, but i cannot get it working:
>>//--------------------------------------------------------
>>$old_track = ini_set('track_errors', '1');
>>
>>if (!@somefunction()) {
>>echo $php_errormsg, "\n";
>>}
>>
>>ini_set('track_errors', $old_track);
>>//--------------------------------------------------------
>>When i execute the cgi, the $php_errormsg variable is always empty, even
>>when there are errors.
>>
>>Any ideas?
>>
>>
>
>I'd probably scratch that approach and use set_error_handler()
>instead. You could even get fancy and create a class that uses
>it so your code could be something like:
>
><?php
> phpErrorHandler::start();
> // some code that causes errors...
> phpErrorHander::stop();
>?>
>
>Although i see this more as a developement tool than production
>solution.
>
>
>Curt
>
>
Thanks for the reply Curt. You are right that this is not a production
solution, but in fact i need to store the warnings somewhere because the
server I have access to has warnings disable, and i need to track the
messages to find which xml documents are malformed and failed to parse.
I´ll try this.

Mariano.


--
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.362 / Virus Database: 267.13.1/169 - Release Date: 15/11/2005

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация