From 1881d292b89192d609fe2a534f5d3a63ac5263d4 Mon Sep 17 00:00:00 2001 From: Adelbert Silla Date: Mon, 29 Apr 2013 10:13:58 +0800 Subject: [PATCH] Fixed text_color and background_color validation exception. --- Generator/CaptchaGenerator.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/Generator/CaptchaGenerator.php b/Generator/CaptchaGenerator.php index 08cde2d..a588a54 100644 --- a/Generator/CaptchaGenerator.php +++ b/Generator/CaptchaGenerator.php @@ -98,17 +98,18 @@ class CaptchaGenerator $this->builder->setMaxFrontLines($options['max_front_lines']); $this->builder->setMaxBehindLines($options['max_behind_lines']); - if ($options['text_color'] != array()) { - if (count($options['text_color'])!=3) { - throw new \RuntimeException('text_color should be an array of r, g and b'); + + if (isset($options['text_color'])) { + if (count($options['text_color']) !== 3) { + throw new \RuntimeException('text_color should be an array of r, g and b'); } $color = $options['text_color']; $this->builder->setTextColor($color[0], $color[1], $color[2]); } - if ($options['background_color'] != array()) { - if (count($options['background_color'])!=3) { + if (isset($options['background_color'])) { + if (count($options['background_color']) !== 3) { throw new \RuntimeException('background_color should be an array of r, g and b'); }