Skip to content
Snippets Groups Projects
Commit 9142d523 authored by Daniel Schultz's avatar Daniel Schultz :tm: Committed by GitHub
Browse files

Merge pull request #136 from OpenTechStrategies/135-fix-picksome

Handle invalid titles
parents c1ab118a 39d9384c
No related branches found
No related tags found
No related merge requests found
......@@ -30,7 +30,8 @@ $wgPickSomePage = function($title) {
$valid_pages = [];
preg_match_all("/\\[\\[([^\\]]*)\\]\\]/", $page->getContent()->getText(), $valid_pages);
foreach($valid_pages[1] as $valid_page) {
if($title->equals(Title::newFromText($valid_page))) {
$valid_page_title = Title::newFromText($valid_page);
if($valid_page_title && $title->equals($valid_page_title)) {
return true;
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment