Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #4380, making get code and get message final #4382

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions hphp/system/php/lang/Exception.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ function __construct($message = '', $code = 0, Exception $previous = null) {
*
* @return mixed Returns the Exception message as a string.
*/
function getMessage() {
final function getMessage() {
return $this->message;
}

Expand Down Expand Up @@ -108,7 +108,7 @@ final function setPreviousChain(Exception $previous) {
* but possibly as other type in Exception descendants
* (for example as string in PDOException).
*/
function getCode() {
final function getCode() {
return $this->code;
}

Expand Down
9 changes: 9 additions & 0 deletions hphp/test/slow/exceptions/getcodefinal.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?php
class FooException extends Exception {
protected $code = 123;
public function getCode() {
return $this->code;
}
}
$e = new FooException();
var_dump($e->getCode());
2 changes: 2 additions & 0 deletions hphp/test/slow/exceptions/getcodefinal.php.expectf
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@

Fatal error: Cannot override final method Exception::getCode() in %s on line %s