The docs comment says it returns an int but it often returned a string.
This led to casting this value into an integer in other parts of the
codebase and in extensions (grep MobileFrontend or Echo for EditCount).
Bug: 51633
Change-Id: I6fe5b26c24e674e8148c1fd278774b3fabe844c5
/**
* Get the user's edit count.
- * @return int
+ * @return int, null for anonymous users
*/
public function getEditCount() {
if ( !$this->getId() ) {
// it has not been initialized. do so.
$count = $this->initEditCount();
}
- $this->mEditCount = intval( $count );
+ $this->mEditCount = $count;
wfProfileOut( __METHOD__ );
}
- return $this->mEditCount;
+ return (int) $this->mEditCount;
}
/**
}
if ( isset( $this->prop['editcount'] ) ) {
+ // use intval to prevent null if a non-logged-in user calls
+ // api.php?format=jsonfm&action=query&meta=userinfo&uiprop=editcount
$vals['editcount'] = intval( $user->getEditCount() );
}
$data[$name]['name'] = $name;
if ( isset( $this->prop['editcount'] ) ) {
- $data[$name]['editcount'] = intval( $user->getEditCount() );
+ $data[$name]['editcount'] = $user->getEditCount();
}
if ( isset( $this->prop['registration'] ) ) {