# Strange behaviour with exception blocks

- Thread: https://externals.io/message/7426
- Original archive: https://news-web.php.net/php.internals/7426
- Started by Sebastian Bergmann on 2004-01-30T16:58:09+00:00
- Messages: 1
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #7426 — Sebastian Bergmann — 2004-01-30T16:58:09+00:00

URL: https://externals.io/message/7426#7426

The following code

     public function run(PHPUnit_Framework_Test $test) {
         print_r($test);
         $this->startTest($test);

         print_r($test);
         try {
             $test->runBare();
         }

         catch (PHPUnit_Framework_AssertionFailedError $e) {
             $this->addFailure($test, $e);
         }

         catch (Exception $e) {
             $this->addError($test, $e);
         }

         print_r($test);
         $this->endTest($test);
     }

  prints

     PHPUnit_Tests_Framework_AssertTest Object
     (
         [codeCoverageInformation:private] => Array
             (
             )

         [name:private] => testFail
     )

     PHPUnit_Tests_Framework_AssertTest Object
     (
         [codeCoverageInformation:private] => Array
             (
             )

         [name:private] => testFail
     )

     PHPUnit_Tests_Framework_AssertTest Object
     (
         [codeCoverageInformation:private] => Array
             (
             )

         [name:private] => testfail
     )

  aus.

  After the try{}/catch{} the [name:private] is lower-cased.

-- 
Sebastian Bergmann
http://sebastian-bergmann.de/                   http://phpOpenTracker.de/

Das Buch zu PHP 5: http://professionelle-softwareentwicklung-mit-php5.de/
