-
Notifications
You must be signed in to change notification settings - Fork 7.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix assertion in Exception::getMessage() if $message is a ref
And same for other properties. Encountered in Symfony.
- Loading branch information
Showing
2 changed files
with
54 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters