From: Brad Jorsch Date: Fri, 13 Dec 2013 17:51:47 +0000 (-0500) Subject: Fix TextContent::preSaveTransform() return type X-Git-Tag: 1.31.0-rc.0~17649^2 X-Git-Url: https://git.cyclocoop.org/%7B%24admin_url%7Dcompta/operations/modifier.php?a=commitdiff_plain;h=99da9b9bfe4f3ccc9f1e4f31c860f002adb4bcca;p=lhc%2Fweb%2Fwiklou.git 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 --- 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 ); } /**