https://bugzilla.wikimedia.org/show_bug.cgi?id=32607
Web browser: ---
Bug #: 32607
Summary: User factories return null or false
Product: MediaWiki
Version: 1.19-svn
Platform: All
OS/Version: All
Status: NEW
Severity: normal
Priority: Unprioritized
Component: General/Unknown
AssignedTo: [email protected]
ReportedBy: [email protected]
Classification: Unclassified
The User class propose several factory methods. Most of them will always return
a User object but two of them would not:
User::newFromName() can return false
User::newFromConfirmationCode() can return null
I would prefer having factories return null if no object have been made. This
way we will avoid fatal errors when passing the result to a function explicitly
expecting a User object. Example
<?php
function delete( User $user ) {
// do something
}
delete( User::newFromName( '127.0.0.1' ) );
?>
That code will throw a catchable fatal error since the delete function expect
either a User object or the null value.
--
Configure bugmail: https://bugzilla.wikimedia.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
You are on the CC list for the bug.
_______________________________________________
Wikibugs-l mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l