Download src/php/php-src/Zend/tests/exceptions/bug30162.phpt from meddyrat/dis-bench: direct link, hf CLI and curl.
- Browser
- Download file 879 Bytes
-
https://huggingface.co/datasets/meddyrat/dis-bench/resolve/main/src/php/php-src/Zend/tests/exceptions/bug30162.phpt
- Command line
-
hf download hf://datasets/meddyrat/dis-bench/src/php/php-src/Zend/tests/exceptions/bug30162.phpt
-
curl -L -o bug30162.phpt https://huggingface.co/datasets/meddyrat/dis-bench/resolve/main/src/php/php-src/Zend/tests/exceptions/bug30162.phpt
879 Bytes
| --TEST-- | |
| Bug #30162 (Catching exception in constructor causes lose of $this) | |
| --FILE-- | |
| class FIIFO { | |
| public function __construct() { | |
| $this->x = "x"; | |
| throw new Exception; | |
| } | |
| } | |
| class hariCow extends FIIFO { | |
| public function __construct() { | |
| try { | |
| parent::__construct(); | |
| } catch(Exception $e) { | |
| } | |
| $this->y = "y"; | |
| try { | |
| $this->z = new FIIFO; | |
| } catch(Exception $e) { | |
| } | |
| } | |
| public function __toString() { | |
| return "Rusticus in asino sedet."; | |
| } | |
| } | |
| try { | |
| $db = new FIIFO(); | |
| } catch(Exception $e) { | |
| } | |
| var_dump($db); | |
| $db = new hariCow; | |
| var_dump($db); | |
| --EXPECTF-- | |
| Warning: Undefined variable $db in %s on line %d | |
| NULL | |
| object(hariCow)#%d (2) { | |
| ["x"]=> | |
| string(1) "x" | |
| ["y"]=> | |
| string(1) "y" | |
| } | |