From 99da9b9bfe4f3ccc9f1e4f31c860f002adb4bcca Mon Sep 17 00:00:00 2001 From: Brad Jorsch Date: Fri, 13 Dec 2013 12:51:47 -0500 Subject: [PATCH] Fix TextContent::preSaveTransform() return type TextContent::preSaveTransform should return an object of the same class as $this, not a WikitextContent. Apparently this was never noticed because most code paths rtrim the input and TextContent::preSaveTransform returns $this if the rtrim is a no-op on the input. Bug: 58451 Change-Id: I9f8f78d52448d1ba055a654a12ff4fad86756110 --- includes/content/TextContent.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/content/TextContent.php b/includes/content/TextContent.php index d03d61e913..ffb5cf27df 100644 --- a/includes/content/TextContent.php +++ b/includes/content/TextContent.php @@ -151,7 +151,7 @@ class TextContent extends AbstractContent { $text = $this->getNativeData(); $pst = rtrim( $text ); - return ( $text === $pst ) ? $this : new WikitextContent( $pst ); + return ( $text === $pst ) ? $this : new static( $pst ); } /** -- 2.20.1