-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Fixes #6730 : close() xml reader on fromFile() and fromString() #6761
Conversation
Shouldn't the same be done in |
fromString() doesn't have open() that pointed to document, I think it doesn't need close then |
|
ok, I've added to fromString() too, thank you. |
@Ocramius I think it's merge-able now ;) |
@samsonasik is there no way to test this change? |
@Ocramius $reader is protected property that instantiated via : $this->reader = new XMLReader(); in |
@samsonasik no, there is no need to make it publicly accessible, but something may be triggering the bug here, no? |
not sure, but fromFile and fromString always instantiate new class. so I think it is ok... Warm regards, Abdul Malik Ikhsan Pada 22 Des 2014, pukul 10.48, Marco Pivetta [email protected] menulis:
|
@samsonasik yes, but what is being fixed here? To give you a perspective of what should happen: if I remove this patch later on, will the change be noticed? |
@Ocramius to check this, I think there is should be a function to check $xml = new XmlReader();
$xml->open('foo.xml'); // correct xml
$xml->setParserProperty(XMLReader::VALIDATE, true);
var_dump($xml->isValid()); // will return true
$xml->close();
var_dump($xml->isValid()); // will return false how ? |
Looks more like something that could cause misbehavior on multiple usages of the same reader instances: maybe try that and see if there is unexpected behavior? |
@Ocramius ok, I will try that. |
bc17ac6
to
907b5fc
Compare
@Ocramius I've updated the code and added unit tests to test applying setParserProperty after using fromFile() or fromString() get php error warning. please let me know if there is something I missed ;) |
* | ||
* @return XMLReader | ||
*/ | ||
public function getReader() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I need to find a test case that doesn't need to access internal deps or check their state...
Pulling locally and attempting to fix the test |
Rebased and merged, thanks @samsonasik! |
…onfig reader should disallow opening non existing files
…sing reflection to access the internal config reader
…sing reflection to access the internal config reader
…emoving newly introduced getter (not needed)
…implifying test case for non-existing paths
…emoving unused variable
…larifying on weird warning assertions
…endframework#6730-xmlreader-fromfile-and-fromstring-should-be-closed' Close zendframework/zendframework#6761 Close zendframework/zendframework#6730
…endframework#6730-xmlreader-fromfile-and-fromstring-should-be-closed' into develop Close zendframework/zendframework#6761 Close zendframework/zendframework#6730 Forward port zendframework/zendframework#6761 Forward port zendframework/zendframework#6730
Fixes #6730