Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on Jan 8, 2020. It is now read-only.

#5465 use strlen instead of empty#5499

Merged
Maks3w merged 5 commits into
zendframework:masterfrom
jeremyquinton:issue-5465
Feb 20, 2014
Merged

#5465 use strlen instead of empty#5499
Maks3w merged 5 commits into
zendframework:masterfrom
jeremyquinton:issue-5465

Conversation

@jeremyquinton
Copy link
Copy Markdown
Contributor

No description provided.

@jeremyquinton
Copy link
Copy Markdown
Contributor Author

by mistake hadn't set my global name and email address for git hence the commit coming from someone named root.

@Ocramius
Copy link
Copy Markdown
Member

@jeremyquinton test required

@jeremyquinton
Copy link
Copy Markdown
Contributor Author

I will commit one this evening.

@jeremyquinton
Copy link
Copy Markdown
Contributor Author

@Ocramius unit test as requested.

@marc-mabe
Copy link
Copy Markdown
Member

Btw: (string)$var === "" is much faster then strlen($var) == 0

@Maks3w Maks3w self-assigned this Feb 20, 2014
@Maks3w Maks3w added this to the 2.2.6 milestone Feb 20, 2014
@Maks3w
Copy link
Copy Markdown
Member

Maks3w commented Feb 20, 2014

@jeremyquinton Please fix the cs and this will be merged.

@jeremyquinton
Copy link
Copy Markdown
Contributor Author

@Maks3w when you say cs do you mean code style and are you referring to the comment above yours.

@Maks3w
Copy link
Copy Markdown
Member

Maks3w commented Feb 20, 2014

@jeremyquinton yes, code style. See travis report for to see where your code is failing.

@jeremyquinton
Copy link
Copy Markdown
Contributor Author

@Maks3w
Build is still failing. Travis CI says
ZendTest/Filter/StripTagsTest.php (trailing_spaces)

I'm not 100% sure what trailing spaces it means but any guidance appreciated.

PSR-2 https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md

states
there MUST NOT be trailing whitespace at the end of non-blank lines.

I don't have any trailing whitespace that I can see

@jeremyquinton
Copy link
Copy Markdown
Contributor Author

will give this https://github.com/fabpot/PHP-CS-Fixer a try leave it to me

Maks3w added a commit that referenced this pull request Feb 20, 2014
Maks3w added a commit that referenced this pull request Feb 20, 2014
Maks3w added a commit that referenced this pull request Feb 20, 2014
@Maks3w Maks3w merged commit ddb6a34 into zendframework:master Feb 20, 2014
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Shouldn't there be a strict comparison, since strlen() may return null?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

from http://uk3.php.net/strlen strlen returns null if called on an array. Is there another circumstance when strlen can return null?

I wrote this fix a couple months ago but unless $matches[3][$index] is an array at any point I think this should be ok.

I can't find the code I used to reproduce the issue. In the next week what I will do is rewrite the code to reproduce the issue and see what the value of $matches[3][$index] is to get a feel for if it can every be an array.

gianarb pushed a commit to zendframework/zend-filter that referenced this pull request May 15, 2015
gianarb pushed a commit to zendframework/zend-filter that referenced this pull request May 15, 2015
gianarb pushed a commit to zendframework/zend-filter that referenced this pull request May 15, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants