bug76502.phpt 1.2 KB

123456789101112131415161718192021222324252627282930313233343536
  1. --TEST--
  2. Bug #76502: Chain of mixed exceptions and errors does not serialize properly
  3. --FILE--
  4. <?php
  5. $examples = [
  6. "Exception(Exception())" => new Exception("outer", 0, new Exception("inner")),
  7. "Error(Error())" => new Error("outer", 0, new Error("inner")),
  8. "Error(Exception())" => new Error("outer", 0, new Exception("inner")),
  9. "Exception(Error())" => new Exception("outer", 0, new Error("inner"))
  10. ];
  11. foreach ($examples as $name => $example) {
  12. $processed = unserialize(serialize($example));
  13. $processedPrev = $processed->getPrevious();
  14. echo "---- $name ----\n";
  15. echo "before: ", get_class($example), ".previous == ",
  16. get_class($example->getPrevious()), "\n";
  17. echo "after : ", get_class($processed), ".previous == ",
  18. $processedPrev ? get_class($processedPrev) : "null", "\n";
  19. }
  20. ?>
  21. --EXPECT--
  22. ---- Exception(Exception()) ----
  23. before: Exception.previous == Exception
  24. after : Exception.previous == Exception
  25. ---- Error(Error()) ----
  26. before: Error.previous == Error
  27. after : Error.previous == Error
  28. ---- Error(Exception()) ----
  29. before: Error.previous == Exception
  30. after : Error.previous == Exception
  31. ---- Exception(Error()) ----
  32. before: Exception.previous == Error
  33. after : Exception.previous == Error