From 13ca36821a14fa40068ae3246dc49940aa02e2af Mon Sep 17 00:00:00 2001 From: "C. Scott Ananian" Date: Wed, 4 Sep 2024 15:05:23 -0400 Subject: [PATCH] ParserOutput::collectMetadata: Properly handle non-scalar page properties ParserOutput::setPageProperty() was deprecated for use with non-string values in 1.42 but there are still callers out there; handle these cases without the implicit cast to string which ::setUnsortablePageProperty() would do via its argument type hint. Bug: T374046 Bug: T373920 Followup-To: I68c28b0d5d23decc058a46c55e767a83c80452f8 Followup-To: I9a235ae828c2cadc9d2c619760f759e51ba73874 Change-Id: I52ecce78fcee8b18cf9d7ea848946f29e2d8b51b --- includes/parser/ParserOutput.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/includes/parser/ParserOutput.php b/includes/parser/ParserOutput.php index 3589b0041d2..543036c9e50 100644 --- a/includes/parser/ParserOutput.php +++ b/includes/parser/ParserOutput.php @@ -2551,11 +2551,12 @@ class ParserOutput extends CacheTime implements ContentMetadataCollector { foreach ( $this->mProperties as $prop => $value ) { if ( is_numeric( $value ) ) { $metadata->setNumericPageProperty( $prop, $value ); - } else { - // T373920: Scalar but neither numeric nor string, so probably boolean - // It is too noisy to log here now. We can revisit logging once we fix - // the known sites from T374046. + } elseif ( is_string( $value ) ) { $metadata->setUnsortedPageProperty( $prop, $value ); + } else { + // Deprecated, but there are still sites which call + // ::setPageProperty() with "unusual" values (T374046) + $metadata->setPageProperty( $prop, $value ); } } foreach ( $this->mWarningMsgs as $msg => $args ) { -- 2.11.4.GIT