From ba690d5451a197fba476380c70e959f83cd46f5d Mon Sep 17 00:00:00 2001 From: Carsten Brandt Date: Mon, 23 Jun 2014 13:45:34 +0200 Subject: [PATCH] Imagick image can not be converted to string on HHVM made it consistent with the GD function. See also https://github.com/yiisoft/yii/pull/3406 --- framework/CHANGELOG.md | 1 + framework/captcha/CaptchaAction.php | 7 +++---- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/framework/CHANGELOG.md b/framework/CHANGELOG.md index 0793342d12..14eb2e62a6 100644 --- a/framework/CHANGELOG.md +++ b/framework/CHANGELOG.md @@ -55,6 +55,7 @@ Yii Framework 2 Change Log - Bug: Fixed inconsistent return of `\yii\console\Application::runAction()` (samdark) - Bug: URL encoding for the route parameter added to `\yii\web\UrlManager` (klimov-paul) - Bug: Fixed the bug that requesting protected or private action methods would cause 500 error instead of 404 (qiangxue) +- Bug: Fixed Object of class Imagick could not be converted to string in CaptchaAction (eXprojects, cebe) - Enh #2264: `CookieCollection::has()` will return false for expired or removed cookies (qiangxue) - Enh #2435: `yii\db\IntegrityException` is now thrown on database integrity errors instead of general `yii\db\Exception` (samdark) - Enh #2837: Error page now shows arguments in stack trace method calls (samdark) diff --git a/framework/captcha/CaptchaAction.php b/framework/captcha/CaptchaAction.php index 51817cb89e..a97b87e74a 100644 --- a/framework/captcha/CaptchaAction.php +++ b/framework/captcha/CaptchaAction.php @@ -247,7 +247,7 @@ class CaptchaAction extends Action /** * Renders the CAPTCHA image based on the code using GD library. * @param string $code the verification code - * @return string image contents + * @return string image contents in PNG format. */ protected function renderImageByGD($code) { @@ -300,7 +300,7 @@ class CaptchaAction extends Action /** * Renders the CAPTCHA image based on the code using ImageMagick library. * @param string $code the verification code - * @return \Imagick image instance. Can be used as string. In this case it will contain image contents. + * @return string image contents in PNG format. */ protected function renderImageByImagick($code) { @@ -332,8 +332,7 @@ class CaptchaAction extends Action } $image->setImageFormat('png'); - - return $image; + return $image->getImageBlob(); } /**