php-src/Zend/tests/exceptions/exception_getters_with_ref_props.phpt
DanielEScherzer 275f63e7fd
Zend/tests: organize some tests with subdirectories (2) (#16423)
Move more low-hanging fruit, creating new directories for the tests for:

* comparisons
* dynamic calls
* error messages
* `error_reporting()`
* exceptions
* `foreach()`
* garbage collection
* group `use` statements
* heredoc and nowdoc
* `goto` jumps
* late static binding
* magic methods
* namespaces
* numeric literal separators
* objects
* `settype()`
* cleaning of temporary values
* `unset()`

Additionally, move some tests into the existing subdirectory for `list()`
tests.

Drive-by fixes of some test numbers in the names of the `goto` tests.

Work towards GH-15631
2024-10-14 12:14:42 +01:00

30 lines
642 B
PHP

--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)