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

#5465 use strlen instead of empty #5499

Merged
merged 5 commits into from
Feb 20, 2014

Conversation

jeremyquinton
Copy link
Contributor

No description provided.

@jeremyquinton
Copy link
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
Member

@jeremyquinton test required

@jeremyquinton
Copy link
Contributor Author

I will commit one this evening.

@jeremyquinton
Copy link
Contributor Author

@Ocramius unit test as requested.

@marc-mabe
Copy link
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
Member

Maks3w commented Feb 20, 2014

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

@jeremyquinton
Copy link
Contributor Author

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

@Maks3w
Copy link
Member

Maks3w commented Feb 20, 2014

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

@jeremyquinton
Copy link
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
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
@@ -282,7 +282,7 @@ protected function _filterTag($tag)
foreach ($matches[1] as $index => $attributeName) {
$attributeName = strtolower($attributeName);
$attributeDelimiter = empty($matches[2][$index]) ? $matches[4][$index] : $matches[2][$index];
$attributeValue = empty($matches[3][$index]) ? $matches[5][$index] : $matches[3][$index];
$attributeValue = (strlen($matches[3][$index]) == 0) ? $matches[5][$index] : $matches[3][$index];
Copy link
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
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
# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants