-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Zend\Form Should throw exception if try to get() an element that does not exist #4572
Conversation
All the tests passed on Travis, but Travis still reports failure |
@joshribakoff The manual links to the specific page in the documentation repository -- the left sidebar has both "show source" and "edit source" links (on each of framework.zend.com and rtfd.org). The repository itself is https://github.com/zendframework/zf2-documentation. As for the failure on 5.3.3, I've retriggered the job to see if it runs differently. One thing we've seen happen in the past with 5.3.3 is that changes that are incompatible with that version occasionally trigger segfaults, which you typically cannot detect from the logged output. If the failure occurs again, I suggest trying to run with 5.3.3, or finding somebody else to run your branch under 5.3.3, to see what the errors are. |
@@ -10,6 +10,7 @@ | |||
namespace Zend\Form; | |||
|
|||
use Traversable; | |||
use Zend\Form\Exception\InvalidElementException; |
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.
This does not need to be imported; just refer to it as Exception\InvalidElementException
. (We only import if the class/namespace can not be resolved relative to the current namespace, or to resolve ambiguous names.)
…ould use sprintf, message should not use punctuation & should not import the exception class
Ok I made the requested changes. Out of curiosity what do you mean "PHP displays the message as sentence fragments"? I did a Google search about this but couldn't find any information, and I'd like to learn. I also ran the tests on my laptop, which uses PHP 5.3.x, but not 5.3.3 specifically. The tests passed there. I'd have to compile from source to test that version specifically. I will attempt that & comment back. |
PHP displays exceptions something like "InvalidArgumentException with Since the errors only exist on 5.3.3, we need to figure out what exactly is On Saturday, June 1, 2013, Josh Ribakoff wrote:
Matthew Weier O'Phinney |
I installed php-5.3.3, using phpbrew. I ran the tests for Zend\Form and they all passed. When I run tests for all components, I get some failures in unrelated components. These failures occur even without my changes present. I tried asking about this in IRC but have not received any response as of yet.
(test progress omitted)
I did see test failures in ZendTest/Json under 5.3.3, these are not my failures:
I also have another failure when running tests, that occurs even without my changes present, when using php-5.3.3:
|
So, I've just merged your PR locally, and when I run PHPUnit under 5.3.3, I get a segfault. I generally then run PHPUnit with the To the best of my knowledge, the error is happening in As such, I'm going to break it into two test cases with separate data providers to see if I can get these tests passing. |
Zend\Form Should throw exception if try to get() an element that does not exist
- PHPUnit under PHP 5.3.3 was throwing segfaults when run with no arguments, and yet passing fine when given --tap and other arguments. Based on experimentation, it appeared to be solely based on the number of items in the data provider. Split the data provider and test case into two, and all problems were solved.
I'm one of your ZF1 certified engineers and this documentation is difficult to follow for me. In your 'getting started' guide, you did not call parent::__construct(). This made it so I can't even display my form. I couldn't find the documentation to do a pull request for that part
If you do this in your view:
echo $this->formRow($form->get('field_that_doesnt_exist'));
Instead of a helpful message like "trying to get() a field that doesnt exist", the obscure error message I actually got was:
"Catchable fatal error: Object of class Zend\Form\View\Helper\FormRow could not be converted to string"
This pull request will throw an exception if you try to get() an element that does not exist.