-
Notifications
You must be signed in to change notification settings - Fork 772
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
findMessages() broken #85
Comments
Ahh I've seen that one before, please try the development branch it was fixed @b3aaa8c0a37ef90552f88474ce58ab41b2fac4be or don't use findMessage() since that's where the problem is and getMessage() does not suffer the same. @ed100 Well done now you've gone the full circle so I am keen to see your improvements next. If you don't feel you want to contribute code that is also fine. You obviously have a talent for finding everything possible thing may go wrong and your explanations are very concise and easy to follow. We desperately need a good tester like yourself to comb through the other projects as well if you would be so kind, much obliged. I was also thinking that we should probably transfer what's been said on #84 to the documentation or start a FAQ to help the next person that comes around. Would you be keen to give us a hand? No matter how small the contribution we always appreciate it. I cannot start to explain what a huge benefit it's been for us to go through the motions with you and reach a successful resolve. Thank you very much! Keep up the good work... |
I will try the dev branch. I would be glad to help as soon as I finish On my second try I got the error: that does not seem caused by findMessage. On 08/16/2012 03:01 PM, Nick Lombard wrote:
|
Then break things it is! =) Always nice to know someone has your back. Glad to have you on board! Let me know if that also fixes findMessages() for you, please. |
all I need is just the one file from dev branch: On 08/16/2012 03:54 PM, Nick Lombard wrote:
|
I would just replace everything if I were you... just overwrite what is in the pear folder that should do the trick. |
replace it all with the files from tried: try { Catchable fatal error: Argument 1 passed to Now what should I do? On 08/16/2012 04:10 PM, Nick Lombard wrote:
|
Give this one a go: <?php
try {
$usernameValidator->assert('really messed up screen#name');
} catch(\InvalidArgumentException $e) {
var_dump($e->findMessages(array('alnum', 'length', 'noWhitespace')));
} I am making this leap because findMessages has a type hint array see <?php
public function findMessages(array $paths)
{
///
} If that doesn't work then I will need to see what you are doing from declaring $usernameValidator up and until the end of the catch please. |
Made the needed corrections on |
That does not give a parse error, The var_dump is: I looked at the findMessges, and didn't understand what the $paths What I am aiming for is displaying my error message to the use depending Then I will have code to end the page so they can fix their error. On 08/16/2012 06:26 PM, Nick Lombard wrote:
|
You can try getFullMessag() or just getMessage() the latter will only have the last error and the first one will return a string with all errors =) You are a coder after all =) just patience and more confidence it will come. |
@ed100 What's happening did you have success? |
not have time to work on it -- was very busy doing a few other things. On 08/17/2012 02:44 PM, Nick Lombard wrote:
|
=) |
Hey @ed100, any news on this? Did that worked for you? Please let us know if you're having any problems =) |
findMessages() uses arrays! $usernameValidator = Validator::alnum('_')->length(1,15)->noWhitespace();
try {
$usernameValidator->assert('really messed up screen#name');
} catch(\InvalidArgumentException $e) {
var_dump($e->findMessages(array('alnum', 'length', 'noWhitespace')));
} Try this ;) |
Does this issue still valid? Can we close this? |
you can close it Thanks for you help On 12/18/2012 07:06 AM, Augusto Pascutti wrote:
|
@ed100 Thank you for you feedback man! =D |
As reported by @ed100 in #84
I tried some validations and worked fine.
then I tried to do error messages:
try {
$usernameValidator->assert('really messed up screen#name');
} catch(\InvalidArgumentException $e) {
var_dump($e->findMessages('alnum', 'length', 'noWhitespace'));
}
That give an error:
Catchable fatal error: Argument 1 passed to
Respect\Validation\Exceptions\AbstractNestedException::findMessages()
must be of the type array, string given, called in
/usr/websites/www/validationpage.html on line 14 and defined in
/usr/local/share/pear/Respect/Validation/Exceptions/AbstractNestedException.php
on line 22
also tried on a different try than above:
$errors = $e->findMessages(
'alnum' => '{{name}} must contain only letters and digits',
'length' => '{{name}} must not have more than 15 chars',
'noWhitespace' => '{{name}} cannot contain spaces'
);
and got error:
Parse error: syntax error, unexpected '=>' (T_DOUBLE_ARROW) in
/usr/websites/www/validationpage.html on line 11
The text was updated successfully, but these errors were encountered: