common.inc 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. <?php
  2. /*
  3. * Common definition and Settings
  4. */
  5. // Custom Error Hanlder for testing
  6. function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
  7. global $debug;
  8. $err_type = array (
  9. 1 => "Error", // E_ERROR
  10. 2 => "Warning", // E_WARINING
  11. 4 => "Parsing Error", // E_PARSE
  12. 8 => "Notice", // E_NOTICE
  13. 16 => "Core Error", // E_CORE_ERROR
  14. 32 => "Core Warning", // E_CORE_WARNING
  15. 64 => "Compile Error", // E_COMPILE_ERROR
  16. 128 => "Compile Warning", // E_COMPILE_WARNING
  17. 256 => "User Error", // E_USER_ERROR
  18. 512 => "User Warning", // E_USER_WARMING
  19. 1024=> "User Notice", // E_USER_NOTICE
  20. 2048=> "Strict Notice", // E_STRICT
  21. 4096=> "Catchable fatal error", // E_RECOVERABLE_ERROR
  22. );
  23. if (!empty($debug)) {
  24. printf("%s: %s (%d)\n", $err_type[$err_no], $err_msg, $linenum);
  25. }
  26. else {
  27. printf("ERR: %s\n",$err_type[$err_no]);
  28. }
  29. }
  30. set_error_handler('test_error_handler');
  31. // Var def for testing
  32. $t_ary = array(
  33. 's1' => '日本語EUC-JPの文字列',
  34. 's2' => 'English Text'
  35. );
  36. class tc
  37. {
  38. public $s1 = '日本語EUC-JPの文字列';
  39. public $s2 = 'English Text';
  40. function tc()
  41. {
  42. }
  43. }
  44. $t_obj = new tc;
  45. ?>