Rudloff has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/327420 )

Change subject: Use getimagesizefromstring() instead of getimagesize()
......................................................................

Use getimagesizefromstring() instead of getimagesize()

getimagesize() outputs warnings when the file does not exist
or when allow_url_fopen is disabled.
Now we use MWHttpRequest to retrieve the file instead
so we don't have a warning if the file can't be retrieved.

Bug: T153250
Change-Id: If1365924e52625a0c6346411faae300b2f83c25a
---
M includes/api/ApiWebappManifest.php
1 file changed, 7 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/MobileFrontend 
refs/changes/20/327420/1

diff --git a/includes/api/ApiWebappManifest.php 
b/includes/api/ApiWebappManifest.php
index cac0de7..8e09508 100644
--- a/includes/api/ApiWebappManifest.php
+++ b/includes/api/ApiWebappManifest.php
@@ -28,11 +28,16 @@
                $appleTouchIcon = $config->get( 'AppleTouchIcon' );
                if ( $appleTouchIcon !== false ) {
                        $appleTouchIconUrl = wfExpandUrl( $appleTouchIcon, 
PROTO_RELATIVE );
-                       $appleTouchIconSize = getimagesize( $appleTouchIconUrl 
);
+                       $request = MWHttpRequest::factory( $appleTouchIconUrl );
+                       $request->execute();
+                       $appleTouchIconContent = $request->getContent();
+                       if ( !empty( $appleTouchIconContent ) ) {
+                               $appleTouchIconSize = getimagesizefromstring( 
$appleTouchIconContent );
+                       }
                        $icon = [
                                'src' => $appleTouchIcon
                        ];
-                       if ( $appleTouchIconSize !== false ) {
+                       if ( isset( $appleTouchIconSize ) && 
$appleTouchIconSize !== false ) {
                                $icon['sizes'] = 
$appleTouchIconSize[0].'x'.$appleTouchIconSize[1];
                                $icon['type'] = $appleTouchIconSize['mime'];
                        }

-- 
To view, visit https://gerrit.wikimedia.org/r/327420
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: If1365924e52625a0c6346411faae300b2f83c25a
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/MobileFrontend
Gerrit-Branch: master
Gerrit-Owner: Rudloff <cont...@rudloff.pro>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to