Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> Error handler a Notice
spenalzo
post
Post #1





Grupa: Zarejestrowani
Postów: 2 064
Pomógł: 1
Dołączył: 22.01.2003
Skąd: Poznań

Ostrzeżenie: (0%)
-----


Hej, mam taki problem (nie, nie z Neostradą):
otóż zrobiłem sobie obsługę błędów poprzez kod z manuala i jak mam ustawić, żeby nie wyświetlał notice?

[php:1:fd60a76dbc]<?php
function mobi_error ($errno, $errmsg, $filename, $linenum, $vars) {
global $error_message;
$errortype = array (
1 => "Error",
2 => "Warning",
4 => "Parsing Error",
8 => "Notice",
16 => "Core Error",
32 => "Core Warning",
64 => "Compile Error",
128 => "Compile Warning",
256 => "User Error",
512 => "User Warning",
1024=> "User Notice"
);
$user_errors = array(E_USER_ERROR, E_USER_WARNING, E_USER_NOTICE);
$err .= "<b>Error: <i>".$errortype[$errno]."</i></b><br>n";
$err .= wordwrap($errmsg,30,"<br>",true)." in file ";
$err .= basename($filename).", line: ";
$err .= $linenum."<br>";
$error_message=$err;
}
$error_message=set_error_handler("mobi_error");

// gdzies dalej wyswietlanie
?>[/php:1:fd60a76dbc]


--------------------

Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi (1 - 1)
adwol
post
Post #2





Grupa: Zarejestrowani
Postów: 691
Pomógł: 0
Dołączył: 6.08.2003

Ostrzeżenie: (0%)
-----


Cytat
i jak mam ustawić, żeby nie wyświetlał notice?

[php:1:38711b4191]<?php
if ($errno & 8)
return;
?>[/php:1:38711b4191]
Cytat
[php:1:38711b4191]<?php
$error_message=set_error_handler("mobi_error");
?>[/php:1:38711b4191]

Ale tego to nie rozumiem. set_error_handler zwraca poprzedni handler błędów, a skoro $error_message jest zmienną z błędem to chyba nie o to chodzi.
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 19.08.2025 - 19:44