I see this extension makes use of empty() in quite a few places.
$ ack empty -Q --php -A3 DataCollector.php 122: if ( empty( $licenseData['LicenseShortName'] ) ) { 123- $problems[] = 'no-license'; 124- } 125: if ( empty( $informationData['ImageDescription'] ) ) { 126- $problems[] = 'no-description'; 127- } 128: if ( empty( $informationData['Artist'] ) && empty( $informationData['Attribution'] ) ) { 129- $problems[] = 'no-author'; 130- } 131: if ( empty( $informationData['Credit'] ) && empty( $informationData['Attribution'] ) ) { 132- $problems[] = 'no-source'; 133- } 134- -- 368: if ( empty( $licenses ) ) { 369- return array(); 370- } 371- -- 390: if ( empty( $deletions ) ) { 391- return array(); 392- } 393- return $deletions[0]; TemplateParser.php 127: if ( !$html ) { // DOMDocument does not like empty strings 128- return array(); 129- } 130-
The empty() function is one of PHP's worst and has a track record keeping a steady flow of small and big bugs in the MediaWiki landscape. Its behaviour also changed throughout PHP past releases.
empty( $var ) essentially does !isset( $var ) || !$var. It's unlikely the author wanted to account for the property potentially not existing, and also had to account for all the things that cast to boolean false in PHP (no control over the type of value being null, array, int, float, boolean, or string).
Use of empty() makes it hard to distinguish intentional tolerance from common errors and provides no advantage over other approaches. It makes for code that is hard to understand, maintain, support, debug and iterate upon.
Please use isset() and/or other more strict assertions instead.