}
}
- $defaultProtoWithoutSlashes = substr( $defaultProto, 0, -2 );
+ $defaultProtoWithoutSlashes = $defaultProto !== null ? substr( $defaultProto, 0, -2 ) : '';
if ( substr( $url, 0, 2 ) == '//' ) {
$url = $defaultProtoWithoutSlashes . $url;
// Look at message to see if this is a class not found failure
// HHVM: Class undefined: foo
- // PHP5: Class 'foo' not found
+ // PHP7: Class 'foo' not found
if ( preg_match( "/Class (undefined: \w+|'\w+' not found)/", $message ) ) {
// phpcs:disable Generic.Files.LineLength
$msg = <<<TXT
// Special code for ogg - detect if it's video (theora),
// else label it as sound.
- if ( $mime == 'application/ogg' && file_exists( $path ) ) {
+ if ( $mime == 'application/ogg' && is_string( $path ) && file_exists( $path ) ) {
// Read a chunk of the file
$f = fopen( $path, "rt" );
if ( !$f ) {
$line = $a->current(); # Workaround for broken ArrayIterator::next() that returns "void"
$s = substr( $s, 1 );
+ if ( is_null( $this->mTitle ) ) {
+ throw new MWException( __METHOD__ . ": \$this->mTitle is null\n" );
+ }
+ $nottalk = !$this->mTitle->isTalkPage();
+
$useLinkPrefixExtension = $this->getTargetLanguage()->linkPrefixExtension();
$e2 = null;
if ( $useLinkPrefixExtension ) {
# e.g. in the case of 'The Arab al[[Razi]]', 'al' will be matched
$charset = $this->contLang->linkPrefixCharset();
$e2 = "/^((?>.*[^$charset]|))(.+)$/sDu";
- }
-
- if ( is_null( $this->mTitle ) ) {
- throw new MWException( __METHOD__ . ": \$this->mTitle is null\n" );
- }
- $nottalk = !$this->mTitle->isTalkPage();
-
- if ( $useLinkPrefixExtension ) {
$m = [];
if ( preg_match( $e2, $s, $m ) ) {
$first_prefix = $m[2];
if ( $subpage !== null ) {
$provided = Title::newFromText( $subpage );
$base = $provided;
- }
- if ( $provided && strpos( $subpage, '/' ) !== false ) {
- $pos = strrpos( $subpage, '/' );
- $basepage = substr( $subpage, 0, $pos );
- $code = substr( $subpage, $pos + 1 );
- if ( strlen( $code ) && Language::isKnownLanguageTag( $code ) ) {
- $base = Title::newFromText( $basepage );
+ if ( $provided && strpos( $subpage, '/' ) !== false ) {
+ $pos = strrpos( $subpage, '/' );
+ $basepage = substr( $subpage, 0, $pos );
+ $code = substr( $subpage, $pos + 1 );
+ if ( strlen( $code ) && Language::isKnownLanguageTag( $code ) ) {
+ $base = Title::newFromText( $basepage );
+ }
}
}
$enc = null;
}
- if ( $enc ) {
+ if ( $enc !== null ) {
$chunk = iconv( $enc, "ASCII//IGNORE", $chunk );
}