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

UGC-4028 | Fix DPL warning #5

Merged
merged 11 commits into from
Jan 22, 2024
Merged
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -812,3 +812,4 @@ Many thanks to GreenReaper on GitHub for reporting and finding issues with core
* Added support for PHP 8.0 and PHP 8.1
* Enabled the `SecurityCheck-ReDoS` phan check
* Added buffer overflow check for `dplreplace`
* Fixed `usedby` queries returning all templates
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
},
"require-dev": {
"mediawiki/mediawiki-codesniffer": "41.0.0",
"mediawiki/mediawiki-phan-config": "0.12.0",
"mediawiki/mediawiki-phan-config": "0.12.1",
"mediawiki/minus-x": "1.1.1",
"php-parallel-lint/php-console-highlighter": "1.0.0",
"php-parallel-lint/php-parallel-lint": "1.3.2"
Expand Down
19 changes: 19 additions & 0 deletions i18n/lt.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"@metadata": {
"authors": [
"Nokeoo"
]
},
"intersection_toomanycats": "Klaida: per daug kategorijų!",
"intersection_toofewcats": "Klaida: per mažai kategorijų!",
"intersection_noresults": "Klaida: nėra rezultatų!",
"intersection_noincludecats": "Klaida: turite įtraukti bent vieną kategoriją arba nurodyti vardų sritį!",
"intersection_pcerror": "Šio sąrašo negalima parodyti, nes serveriai perkrauti. Pabandykite dar kartą vėliau.",
"dpl-desc": "Labai lankstus ataskaitų generatorius, skirtas MediaWikis",
"dpl_log_8": "Klaida: vienu metu galima pridėti tik vieną duomenų tipą.",
"dpl_log_9": "Klaida: parametras „$1“ turi būti naudojamas su „ordermethod=[ $2 ]“",
"dpl_log_16": "Įspėjimas: rezultatų nėra.",
"dpl_log_21": "Užklausa: <code>$0</code>",
"dpl_log_23": "Klaida: sąrašas negali būti rodomas, nes serveriai yra perkrauti. Pabandykite dar kartą vėliau.",
"dpl_log_25": "Klaida: $1"
}
2 changes: 1 addition & 1 deletion includes/Article.php
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ public static function newFromRow(
$article = new self( $title, $pageNamespace );

$revActorName = ActorStore::UNKNOWN_USER_NAME;
if ( isset( $row->rev_actor ) ) {
if ( isset( $row->rev_actor ) && $row->rev_actor !== '0' ) {
$revActorName = $userFactory->newFromActorId( $row->rev_actor )->getName();
}

Expand Down
10 changes: 5 additions & 5 deletions includes/LST.php
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ public static function includeSection( $parser, $page = '', $sec = '', $to = '',
preg_match_all( $pat, $text, $m, PREG_PATTERN_ORDER );

foreach ( $m[2] as $nr => $piece ) {
$piece = self::parse( $parser, $piece, "#lst:${page}|${sec}", 0, $recursionCheck, -1, '', $trim, $skipPattern );
$piece = self::parse( $parser, $piece, "#lst:{$page}|{$sec}", 0, $recursionCheck, -1, '', $trim, $skipPattern );

if ( $any ) {
$output[] = $m[1][$nr] . '::' . $piece;
Expand Down Expand Up @@ -509,7 +509,7 @@ public static function extractHeadingFromText( $parser, $page, $title, $text, $s
if ( $nr == -2 ) {
// output text before first section and done
$piece = substr( $text, 0, $m[1][1] - 1 );
$output[0] = self::parse( $parser, $piece, "#lsth:${page}|${sec}", 0, $recursionCheck, $maxLength, $link, $trim, $skipPattern );
$output[0] = self::parse( $parser, $piece, "#lsth:{$page}|{$sec}", 0, $recursionCheck, $maxLength, $link, $trim, $skipPattern );

return $output;
}
Expand Down Expand Up @@ -580,19 +580,19 @@ public static function extractHeadingFromText( $parser, $page, $title, $text, $s

if ( $nr == 1 ) {
// output n-th section and done
$output[0] = self::parse( $parser, $piece, "#lsth:${page}|${sec}", $nhead, $recursionCheck, $maxLength, $link, $trim, $skipPattern );
$output[0] = self::parse( $parser, $piece, "#lsth:{$page}|{$sec}", $nhead, $recursionCheck, $maxLength, $link, $trim, $skipPattern );
break;
}

if ( $nr == -1 ) {
if ( !isset( $end_off ) ) {
// output last section and done
$output[0] = self::parse( $parser, $piece, "#lsth:${page}|${sec}", $nhead, $recursionCheck, $maxLength, $link, $trim, $skipPattern );
$output[0] = self::parse( $parser, $piece, "#lsth:{$page}|{$sec}", $nhead, $recursionCheck, $maxLength, $link, $trim, $skipPattern );
break;
}
} else {
// output section by name and continue search for another section with the same name
$output[$n++] = self::parse( $parser, $piece, "#lsth:${page}|${sec}", $nhead, $recursionCheck, $maxLength, $link, $trim, $skipPattern );
$output[$n++] = self::parse( $parser, $piece, "#lsth:{$page}|{$sec}", $nhead, $recursionCheck, $maxLength, $link, $trim, $skipPattern );
}
} while ( $continueSearch );

Expand Down
2 changes: 1 addition & 1 deletion includes/Parameters.php
Original file line number Diff line number Diff line change
Expand Up @@ -957,7 +957,7 @@ public function _titlematch( $option ) {
public function _nottitleregexp( $option ) {
$data = $this->getParameter( 'nottitle' );

if ( !is_array( $data['regexp'] ) ) {
if ( !$data || !is_array( $data['regexp'] ) ) {
$data['regexp'] = [];
}

Expand Down
4 changes: 2 additions & 2 deletions includes/Parse.php
Original file line number Diff line number Diff line change
Expand Up @@ -886,10 +886,10 @@ private function defineScrollVariables( $scrollVariables, Parser $parser ) {
$scrollVariables = (array)$scrollVariables;

foreach ( $scrollVariables as $variable => $value ) {
Variables::setVar( [ '', '', $variable, $value ] );
Variables::setVar( [ '', '', $variable, $value ?? '' ] );

if ( defined( 'ExtVariables::VERSION' ) ) {
ExtVariables::get( $parser )->setVarValue( $variable, $value );
ExtVariables::get( $parser )->setVarValue( $variable, $value ?? '' );
}
}
}
Expand Down