Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Fix for issue #4267 #5936

Closed
wants to merge 5 commits into from

4 participants

@god107

No description provided.

tests/ZendTest/Feed/Reader/ReaderTest.php
@@ -302,6 +302,12 @@ public function testImportRemoteFeedMethodPerformsAsExpected()
$this->assertEquals(Reader\Reader::TYPE_RSS_20, $type);
}
+ public function testImportStringMethodThrowProperExceptionOnEmptyString(){
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@god107

Ok, I thought that cs fixer is doing that in pre-commit hook.

I don't know why Tests are failed.

@god107

Ok, now it should be correct. Test on my pc passed after first commits but i'm using newer version of PHP. Don't even know before that empty() accepts only variables nor returned values by function prior to PHP 5.5.

@ThaDafinser

@god107 looking sadly at travis there was a timeout...
Maye enhance the test even further and test for is_string()
And display the message: "Only non empty strings are allowed as input"

@god107

ok, i'll fix this but i have question: What about that Travis show timeout for connecting to github:

The command "git clone --depth=50 git://github.com/zendframework/zf2.git zendframework/zf2" failed. Retrying, 3 of 3.
Cloning into 'zendframework/zf2'...
fatal: unable to connect to github.com:
github.com: Temporary failure in name resolution
The command "git clone --depth=50 git://github.com/zendframework/zf2.git zendframework/zf2" failed and exited with 128 during checkout.
@samsonasik
@god107

Strange, now i'm seeing that test in ZendTest/Cache failed but i did'n touch there anything. :/

@samsonasik
@weierophinney weierophinney added this to the 2.3.0 milestone
@weierophinney weierophinney self-assigned this
@weierophinney

Merged to develop for release with 2.3.0.

@god107 god107 deleted the branch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Mar 8, 2014
  1. @god107

    Test

    god107 authored
  2. @god107

    Fix

    god107 authored
  3. @god107

    Fix for PSR-2 standard

    god107 authored
  4. @god107
Commits on Mar 10, 2014
  1. @god107
This page is out of date. Refresh to see the latest.
View
5 library/Zend/Feed/Reader/Reader.php
@@ -299,6 +299,11 @@ public static function importRemoteFeed($uri, Http\ClientInterface $client)
*/
public static function importString($string)
{
+ $trimmed = trim($string);
+ if (!is_string($string) || empty($trimmed)) {
+ throw new Exception\InvalidArgumentException('Only non empty strings are allowed as input');
+ }
+
$libxmlErrflag = libxml_use_internal_errors(true);
$oldValue = libxml_disable_entity_loader(true);
$dom = new DOMDocument;
View
7 tests/ZendTest/Feed/Reader/ReaderTest.php
@@ -302,6 +302,13 @@ public function testImportRemoteFeedMethodPerformsAsExpected()
$this->assertEquals(Reader\Reader::TYPE_RSS_20, $type);
}
+ public function testImportStringMethodThrowProperExceptionOnEmptyString()
+ {
+ $this->setExpectedException('Zend\Feed\Reader\Exception\InvalidArgumentException');
+ $string = ' ';
+ $feed = Reader\Reader::importString($string);
+ }
+
protected function _getTempDirectory()
{
$tmpdir = array();
Something went wrong with that request. Please try again.