{"action":"created","issue":{"url":"https://api.github.com/repos/yiisoft/yii2/issues/8252","labels_url":"https://api.github.com/repos/yiisoft/yii2/issues/8252/labels{/name}","comments_url":"https://api.github.com/repos/yiisoft/yii2/issues/8252/comments","events_url":"https://api.github.com/repos/yiisoft/yii2/issues/8252/events","html_url":"https://github.com/yiisoft/yii2/issues/8252","id":72624925,"number":8252,"title":"Imagick PNG support check error.","user":{"login":"n099y","id":6882164,"avatar_url":"https://avatars.githubusercontent.com/u/6882164?v=3","gravatar_id":"","url":"https://api.github.com/users/n099y","html_url":"https://github.com/n099y","followers_url":"https://api.github.com/users/n099y/followers","following_url":"https://api.github.com/users/n099y/following{/other_user}","gists_url":"https://api.github.com/users/n099y/gists{/gist_id}","starred_url":"https://api.github.com/users/n099y/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/n099y/subscriptions","organizations_url":"https://api.github.com/users/n099y/orgs","repos_url":"https://api.github.com/users/n099y/repos","events_url":"https://api.github.com/users/n099y/events{/privacy}","received_events_url":"https://api.github.com/users/n099y/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-05-02T10:12:06Z","updated_at":"2015-05-02T22:25:21Z","closed_at":null,"body":"G'day guys,\r\n\r\nI could not find the root problem, but I thought I would post it here so its known about.\r\n\r\nMy host has imagick, but the ImageMagick  supported formats are as follows ( from phpinfo() ):\r\n\r\n```\r\n3FR, AAI, AI, ART, ARW, AVI, AVS, BGR, BGRA, BMP, BMP2, BMP3, BRF, CAL, CALS, CAPTION, CIN, CIP, CLIP, CMYK, CMYKA, CR2, CRW, CUR, CUT, DCM, DCR, DCX, DDS, DNG, DOT, DPX, DXT1, DXT5, EPDF, EPT, EPT2, EPT3, ERF, EXR, FAX, FITS, FTS, G3, GIF, GIF87, GRADIENT, GRAY, GV, HALD, HDR, HISTOGRAM, HRZ, HTM, HTML, ICO, ICON, INFO, INLINE, IPL, ISOBRL, JNX, JPEG, JPG, JSON, K25, KDC, LABEL, M2V, M4V, MAC, MAP, MASK, MAT, MATTE, MEF, MIFF, MONO, MOV, MP4, MPC, MPEG, MPG, MRW, MSL, MTV, MVG, NEF, NRW, NULL, ORF, OTB, PALM, PANGO, PATTERN, PCD, PCDS, PCL, PCX, PDB, PDF, PDFA, PEF, PES, PJPEG, RADIAL-GRADIENT, RAF, RW2, SHTML, SR2, SRF, UBRL, WMV, X3F\r\n\r\n```\r\n\r\nYou will notice no PNG in that list.\r\n\r\nBut the function below (from yiisoft/yii2/captcha/Captcha.php)  returns \"imagick\":\r\n```php\r\n    public static function checkRequirements()\r\n    {\r\n        if (extension_loaded('imagick')) {\r\n            $imagick = new \\Imagick();\r\n            $imagickFormats = $imagick->queryFormats('PNG');\r\n            if (in_array('PNG', $imagickFormats)) {\r\n                return 'imagick';\r\n            }\r\n        }\r\n        if (extension_loaded('gd')) {\r\n            $gdInfo = gd_info();\r\n            if (!empty($gdInfo['FreeType Support'])) {\r\n                return 'gd';\r\n            }\r\n        }\r\n        throw new InvalidConfigException('Either GD PHP extension with FreeType support or ImageMagick PHP extension with PNG support is required.');\r\n    }\r\n```\r\nSo you see even though I do not have support for PNG, it is thinking that I do. I have even tried adding exit(); above the return statement to see if that was the path it was taking, and it does indeed use that path.\r\n\r\nBut something else interesting is the following (inside requirements.php) sets $imagickMemo and $imagickOK stays false:\r\n```php\r\n\tif (extension_loaded('imagick')) {\r\n\t\t$imagick = new Imagick();\r\n\t\t$imagickFormats = $imagick->queryFormats('PNG');\r\n\t\tif (in_array('PNG', $imagickFormats)) {\r\n\t\t\t$imagickOK = true;\r\n\t\t} else {\r\n\t\t\t$imagickMemo = 'Imagick extension should be installed with PNG support in order to be used for image CAPTCHA.';\r\n\t\t}\r\n\t}\r\n```\r\nSo you see, on the same system the same basic piece of code seems to give two different results, so I am thinking something else is also going on. I do notice the first one is using namespace where the other one does not. \r\n\r\nAs to the underlying cause, I wish you guys good luck, I have had to swap the code so GD evaluating happens first for it to work for me.\r\n\r\nPeace, n099y."},"comment":{"url":"https://api.github.com/repos/yiisoft/yii2/issues/comments/98409370","html_url":"https://github.com/yiisoft/yii2/issues/8252#issuecomment-98409370","issue_url":"https://api.github.com/repos/yiisoft/yii2/issues/8252","id":98409370,"user":{"login":"tecnologiaterabyte","id":4957021,"avatar_url":"https://avatars.githubusercontent.com/u/4957021?v=3","gravatar_id":"","url":"https://api.github.com/users/tecnologiaterabyte","html_url":"https://github.com/tecnologiaterabyte","followers_url":"https://api.github.com/users/tecnologiaterabyte/followers","following_url":"https://api.github.com/users/tecnologiaterabyte/following{/other_user}","gists_url":"https://api.github.com/users/tecnologiaterabyte/gists{/gist_id}","starred_url":"https://api.github.com/users/tecnologiaterabyte/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tecnologiaterabyte/subscriptions","organizations_url":"https://api.github.com/users/tecnologiaterabyte/orgs","repos_url":"https://api.github.com/users/tecnologiaterabyte/repos","events_url":"https://api.github.com/users/tecnologiaterabyte/events{/privacy}","received_events_url":"https://api.github.com/users/tecnologiaterabyte/received_events","type":"User","site_admin":false},"created_at":"2015-05-02T22:25:21Z","updated_at":"2015-05-02T22:25:21Z","body":"@n099y Windows or Linux Version PHP ?"}}