bug50383.phpt 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. --TEST--
  2. Bug #50383 (Exceptions thrown in __call / __callStatic do not include file and line in trace)
  3. --FILE--
  4. <?php
  5. class myClass {
  6. public static function __callStatic($method, $args) {
  7. throw new Exception("Missing static method '$method'\n");
  8. }
  9. public function __call($method, $args) {
  10. throw new Exception("Missing method '$method'\n");
  11. }
  12. }
  13. function thrower() {
  14. myClass::ThrowException();
  15. }
  16. function thrower2() {
  17. $x = new myClass;
  18. $x->foo();
  19. }
  20. try {
  21. thrower();
  22. } catch(Exception $e) {
  23. print $e->getMessage();
  24. print_r($e->getTrace());
  25. }
  26. try {
  27. thrower2();
  28. } catch (Exception $e) {
  29. print $e->getMessage();
  30. print_r($e->getTrace());
  31. }
  32. ?>
  33. --EXPECTF--
  34. Missing static method 'ThrowException'
  35. Array
  36. (
  37. [0] => Array
  38. (
  39. [file] => %s
  40. [line] => 13
  41. [function] => __callStatic
  42. [class] => myClass
  43. [type] => ::
  44. [args] => Array
  45. (
  46. [0] => ThrowException
  47. [1] => Array
  48. (
  49. )
  50. )
  51. )
  52. [1] => Array
  53. (
  54. [file] => %s
  55. [line] => 21
  56. [function] => thrower
  57. [args] => Array
  58. (
  59. )
  60. )
  61. )
  62. Missing method 'foo'
  63. Array
  64. (
  65. [0] => Array
  66. (
  67. [file] => %s
  68. [line] => 17
  69. [function] => __call
  70. [class] => myClass
  71. [type] => ->
  72. [args] => Array
  73. (
  74. [0] => foo
  75. [1] => Array
  76. (
  77. )
  78. )
  79. )
  80. [1] => Array
  81. (
  82. [file] => %s
  83. [line] => 28
  84. [function] => thrower2
  85. [args] => Array
  86. (
  87. )
  88. )
  89. )