Skip to content

Commit

Permalink
Fix Invalid characters passed for attempted conversion (7.4)
Browse files Browse the repository at this point in the history
  • Loading branch information
remicollet committed Jan 2, 2020
1 parent 53c8739 commit c765b77
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/Object/AbstractObject.php
Original file line number Diff line number Diff line change
Expand Up @@ -429,8 +429,8 @@ public function getFactor()
*/
public function setForeColor($value)
{
if (preg_match('`\#[0-9A-F]{6}`', $value)) {
$this->foreColor = hexdec($value);
if (preg_match('`\#([0-9A-F]{6})`', $value, $reg)) {
$this->foreColor = hexdec($reg[1]);
} elseif (is_numeric($value) && $value >= 0 && $value <= 16777125) {
$this->foreColor = intval($value);
} else {
Expand Down Expand Up @@ -460,8 +460,8 @@ public function getForeColor()
*/
public function setBackgroundColor($value)
{
if (preg_match('`\#[0-9A-F]{6}`', $value)) {
$this->backgroundColor = hexdec($value);
if (preg_match('`\#([0-9A-F]{6})`', $value, $reg)) {
$this->backgroundColor = hexdec($reg[1]);
} elseif (is_numeric($value) && $value >= 0 && $value <= 16777125) {
$this->backgroundColor = intval($value);
} else {
Expand Down

0 comments on commit c765b77

Please sign in to comment.