Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BugFix : count() func error when textColor is null #89

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

MohsenParandvar
Copy link

when count() function receive a null arg happens Warning (in PHP V7+) and Fatal error (in PHP V8+)
with this pull request i tried solve this problem.thanks :)

@S1SYPHOS S1SYPHOS mentioned this pull request Aug 3, 2022
Copy link

@bytestream bytestream left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like $this->textColor should never be null... The default value is array() and the only way to change it is via setTextColor()

if(is_null($this->textColor)){
$this->textColor = array();
}

if (!$this->textColor) {
Copy link

@bytestream bytestream Aug 5, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (!$this->textColor) {
if ($this->textColor === null || ! $this->textColor) {

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So when textColor always be an array, why should it compared with null?
The if is for empty arrays i think.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see you edit it. !$this->textColor should be enough. If $this->textColor is null its also true.

Comment on lines +351 to +355
// Define a empty array when textColor is null
if(is_null($this->textColor)){
$this->textColor = array();
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// Define a empty array when textColor is null
if(is_null($this->textColor)){
$this->textColor = array();
}

@blankse
Copy link

blankse commented Aug 5, 2022

I think this PR is obsolet. It is already fixed by a4f7d0f

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants