[TYPO3-core] FYI24: #8826: calls to ini_set produces warnings
Steffen Kamper
info at sk-typo3.de
Wed Sep 3 12:50:49 CEST 2008
Hi,
Dmitry Dulepov [typo3] schrieb:
> Hi!
>
> Ingo Renner wrote:
>>> How do I change PHP function to throw exceptions? 8-0 file_exists()
>>> produces a PHP warning if the file does not exist. Using @ prevents
>>> this warning and lets the function work as expected.
>>
>> if(!file_exists($file)) {
>> throw new FileNotFoundException();
>> }
>>
>> No need for an @
>
> And you will see a PHP warning with your when file does not exist. It is
> a known behaviour of file_exists(): if file does not exists, you will
> see a warning that file does not exist. No way to prevent it without @.
>
that's what i mentioned before too, it's a lack of PHP.
Only way to do it without @ is a construct like
$error_reporting = error_reporting(0);
if(!file_exists($file)) {
throw new FileNotFoundException();
}
error_reporting($error_reporting);
which isn't a nice way IMHO
vg Steffen
More information about the TYPO3-team-core
mailing list