From b2de66a9a261cae0da6e03ddd3ebd13e1aa6dcf1 Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Tue, 12 Jul 2005 22:50:34 +0000 Subject: [PATCH] * (bug 2825) Fix regression in newtalk notifications for anons w/ enotif off Fixes for invalid usernames now cause User::newFromName to return null for IP addresses, so we have to stuff an anon's name in separately. Todo: User::newFromIP() with IPv4 and IPv6 validity checks would be nice. --- RELEASE-NOTES | 3 +++ includes/Article.php | 11 +++++++---- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index e9f6226f29..e123409e7e 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -563,6 +563,9 @@ of MediaWiki:Newpagetext) to &action=edit, if page is new. * (bug 655) Provide empty search form when searching for nothing * (bug 2802) Display more than one character of the sort key * Nynorsk numeric format fix +* (bug 2825) Fix regression in newtalk notifications for anons w/ enotif off + + === Caveats === Some output, particularly involving user-supplied inline HTML, may not diff --git a/includes/Article.php b/includes/Article.php index 6e5e453e8f..378039d49a 100644 --- a/includes/Article.php +++ b/includes/Article.php @@ -2020,11 +2020,14 @@ class Article { $u = new UserTalkUpdate( 1, $this->mTitle->getNamespace(), $shortTitle, $summary, $minoredit, $timestamp_of_pagechange); } else { - $other = User::newFromName($shortTitle); - if ($other) { - $other->setNewtalk(1); - $other->saveNewtalk(); + $other = User::newFromName( $shortTitle ); + if( is_null( $other ) && User::isIP( $shortTitle ) ) { + // An anonymous user + $other = new User(); + $other->setName( $shortTitle ); } + $other->setNewtalk(1); + $other->saveNewtalk(); } } -- 2.20.1