diff options
| author | Nikita Popov <nikita.ppv@gmail.com> | 2019-02-25 13:00:16 +0100 |
|---|---|---|
| committer | Nikita Popov <nikita.ppv@gmail.com> | 2019-02-25 13:00:16 +0100 |
| commit | af37d58cf7b77814b93ea97a8dcd2afb46c4424e (patch) | |
| tree | 809a59ad86fc4b90355dbe8d3c0c52b62d637dc5 /Zend/tests | |
| parent | 1c22ace0582fb0a2ec581237fcf1c5b9c41edd04 (diff) | |
| download | php-git-af37d58cf7b77814b93ea97a8dcd2afb46c4424e.tar.gz | |
Fix assertion in Exception::getMessage() if $message is a ref
And same for other properties. Encountered in Symfony.
Diffstat (limited to 'Zend/tests')
| -rw-r--r-- | Zend/tests/exception_getters_with_ref_props.phpt | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/Zend/tests/exception_getters_with_ref_props.phpt b/Zend/tests/exception_getters_with_ref_props.phpt new file mode 100644 index 0000000000..d3dcd8326f --- /dev/null +++ b/Zend/tests/exception_getters_with_ref_props.phpt @@ -0,0 +1,30 @@ +--TEST-- +Calling exception getters when properties hold references +--FILE-- +<?php + +class MyException extends Exception { + public function __construct(&$refMsg, &$refCode, &$refFile, &$refLine) { + $this->message =& $refMsg; + $this->code =& $refCode; + $this->file =& $refFile; + $this->line =& $refLine; + } +} + +$refMsg = "foo"; +$refCode = 0; +$refFile = "foobar"; +$refLine = 42; +$ex = new MyException($refMsg, $refCode, $refFile, $refLine); +var_dump($ex->getMessage()); +var_dump($ex->getCode()); +var_dump($ex->getFile()); +var_dump($ex->getLine()); + +?> +--EXPECT-- +string(3) "foo" +int(0) +string(6) "foobar" +int(42) |
