-
-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[2.0.1]RuntimeException: Trying to call method appendmessage on a non-object #10405
Comments
Any update on this? I'm using Phalcon 2.1.X and I'm getting the same error! |
I was checking the source code and the problem seems to occur when It seems to me that the logic is that |
Up, I also have this problem. |
Same here. If I call "method_exists($validator, 'appendMessage')" it returns true, calling appendMessage on the next line will say that validator is not an object ... !? |
@knallcharge what phalcon version you are using ? |
@Jurigag 2.0.8 |
I have 2.0.13 and can't reproduce problem with code from OP. Can you post your code @knallcharge to reproduce this ? |
Using the validator in a unit-test will result in the described behavior. $myValidator = new MyValidator();
$validation = new Phalcon\Validation();
$validation->bind(new stdClass(),
array(
'day' => date('d'),
'month' => date('m'),
'year' => date('Y')+1
));
$myValidator->validate($validation, ''); printing out $validator in the validator itself will return it all right, but using "$validator->appendMessage" in the next line will tell me, it's not an object |
Well actually this code is reproducing a problem: $myValidator = new Phalcon\Validation\Validator\PresenceOf();
$validation = new Phalcon\Validation();
$validation->bind(new stdClass(),
array(
'day' => date('d'),
'month' => date('m'),
'year' => date('Y')+1
));
$myValidator->validate($validation, ''); This line is producing a problem https://github.com/phalcon/cphalcon/blob/2.0.x/phalcon/validation.zep#L322 Well messages are created here - https://github.com/phalcon/cphalcon/blob/2.0.x/phalcon/validation.zep#L106 With this code those messages group is just null on this point. This is why it doesn't work. But i don't really know why you can't just add validator to validation and use I guess that we need to create |
Fixed in the |
Hi,
with phalon 1.3.x we've added error messages to form elements by ->appendMessage.
With phalcon 2.0.1 i've got an runtime exception:
RuntimeException: Trying to call method appendmessage on a non-object
For example:
The text was updated successfully, but these errors were encountered: