forked from php/php-src
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed bug #64821 Custom Exceptions crash when internal properties ove…
…rridden If user inherits Exception and overrides the properties to arbitrary data types, or simply doesn't run parent::__construct(), here we go. Just convert everything to the appropriate data type, like Exception::__toString() does.
- Loading branch information
Showing
5 changed files
with
74 additions
and
1 deletion.
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
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,22 @@ | ||
--TEST-- | ||
Bug #64821 Custom Exceptions crash when internal properties overridden (variation 1) | ||
--FILE-- | ||
<?php | ||
|
||
class a extends exception { | ||
public function __construct() { | ||
$this->message = NULL; | ||
$this->string = NULL; | ||
$this->code = array(); | ||
$this->line = "hello"; | ||
} | ||
} | ||
|
||
throw new a; | ||
|
||
?> | ||
--EXPECTF-- | ||
Fatal error: Uncaught exception 'a' in %s:0 | ||
Stack trace: | ||
#0 {main} | ||
thrown in %s on line %d |
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,19 @@ | ||
--TEST-- | ||
Bug #64821 Custom Exceptions crash when internal properties overridden (variation 2) | ||
--FILE-- | ||
<?php | ||
|
||
class a extends exception { | ||
public function __construct() { | ||
$this->line = array(); | ||
} | ||
} | ||
|
||
throw new a; | ||
|
||
?> | ||
--EXPECTF-- | ||
Fatal error: Uncaught exception 'a' in %s:0 | ||
Stack trace: | ||
#0 {main} | ||
thrown in %s on line %d |
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,20 @@ | ||
--TEST-- | ||
Bug #64821 Custom Exceptions crash when internal properties overridden (variation 3) | ||
--FILE-- | ||
<?php | ||
|
||
class a extends exception { | ||
public function __construct() { | ||
$this->line = array(); | ||
$this->file = NULL; | ||
} | ||
} | ||
|
||
throw new a; | ||
|
||
?> | ||
--EXPECTF-- | ||
Fatal error: Uncaught exception 'a' in :0 | ||
Stack trace: | ||
#0 {main} | ||
thrown in Unknown on line %d |
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