Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [php] error_handler
PiratNowegoPokol...
post 8.03.2007, 19:59:14
Post #1





Grupa: Zarejestrowani
Postów: 132
Pomógł: 0
Dołączył: 12.10.2006

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


  1. <?php
  2. set_error_handler('error_handler');
  3.  
  4. function error_handler( $errno, $errstr, $errfile, $errline )
  5. {
  6. switch ($errno)
  7. {
  8. case E_WARNING:
  9. echo '<b>Warning : </b> ' . $errstr . ' in <b>' . $errfile . '</b> on line : ' . $errline ;
  10. echo "<br>n" ;
  11. break;
  12. }
  13. return true;
  14. }
  15. $string = 'string';
  16. reset( $string );
  17. @reset( $string );
  18. ?>


zwraca :

Kod
Warning :  reset() [function.reset]: Passed variable is not an array or object in C:\PHP\cms\a.php on line : 16
Warning : reset() [function.reset]: Passed variable is not an array or object in C:\PHP\cms\a.php on line : 17


Czy ta funkcja ma tak działać czy to ja popełniłem jakiś błąd :?:
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi (1 - 1)
nospor
post 9.03.2007, 11:56:36
Post #2





Grupa: Moderatorzy
Postów: 36 557
Pomógł: 6315
Dołączył: 27.12.2004




  1. <?php
  2. function error_handler( $errno, $errstr, $errfile, $errline )
  3. {
  4. if(error_reporting() == 0) //o tym zapomniales :)
  5. return true;
  6. switch ($errno)
  7. {
  8. case E_WARNING:
  9. echo '<b>Warning : </b> ' . $errstr . ' in <b>' . $errfile . '</b> on line : ' . $errline ;
  10. echo "<br>n" ;
  11. break;
  12. }
  13. return true;
  14. }
  15. ?>

smile.gif


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

"Myśl, myśl, myśl..." - Kubuś Puchatek || "Manual, manual, manual..." - Kubuś Programista
"Szukaj, szukaj, szukaj..." - Kubuś Odkrywca || "Debuguj, debuguj, debuguj..." - Kubuś Developer

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 Wersja Lo-Fi Aktualny czas: 14.08.2025 - 07:38