Form validation in Windows

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

Form validation in Windows

Alejandro Celaya
Hi folks.

In my company we are having a weird problem.
We have a Form with a Select element with 4 value options.
It is properly validated (an InArrayValidator is included) when we test it in any development machine with Linux, but one of us is using Windows. In his machine invalid values pass as they were valid.
If we remove the element from the InputFilter (asuming no other validations will occur) the InArrayValidation keeps working on any Linux mahine, but on Windows is even more weird. When we call $form->getData() that element has been removed, as if it wasen't added to the form in the first place.

We are getting out of ideas. Is there any incompatibility with windows?

We have checked
Ubuntu + PHP5.5 + ZF2.3 -> Works as expected
Ubuntu + PHP5.4 + ZF2.3 -> Works as expected
Windows 7 + PHP5.4 + ZF2.3 -> Weird errors.

Thank you very much.

--
Alejandro Celaya Alastrué
Reply | Threaded
Open this post in threaded view
|

Re: Form validation in Windows

Spabby
I am only guessing, but do you have a case mismatch somewhere? 



On Fri, Jun 20, 2014 at 2:21 PM, Alejandro Celaya <[hidden email]> wrote:
Hi folks.

In my company we are having a weird problem.
We have a Form with a Select element with 4 value options.
It is properly validated (an InArrayValidator is included) when we test it in any development machine with Linux, but one of us is using Windows. In his machine invalid values pass as they were valid.
If we remove the element from the InputFilter (asuming no other validations will occur) the InArrayValidation keeps working on any Linux mahine, but on Windows is even more weird. When we call $form->getData() that element has been removed, as if it wasen't added to the form in the first place.

We are getting out of ideas. Is there any incompatibility with windows?

We have checked
Ubuntu + PHP5.5 + ZF2.3 -> Works as expected
Ubuntu + PHP5.4 + ZF2.3 -> Works as expected
Windows 7 + PHP5.4 + ZF2.3 -> Weird errors.

Thank you very much.

--
Alejandro Celaya Alastrué

Reply | Threaded
Open this post in threaded view
|

Re: Form validation in Windows

Phillip Harrington
Can you post a gist with a baseline test - everything necessary to reproduce but no extra stuff?

On Fri, Jun 20, 2014 at 9:49 AM, Gary Hockin <[hidden email]> wrote:

I am only guessing, but do you have a case mismatch somewhere? 



On Fri, Jun 20, 2014 at 2:21 PM, Alejandro Celaya <[hidden email]> wrote:
Hi folks.

In my company we are having a weird problem.
We have a Form with a Select element with 4 value options.
It is properly validated (an InArrayValidator is included) when we test it in any development machine with Linux, but one of us is using Windows. In his machine invalid values pass as they were valid.
If we remove the element from the InputFilter (asuming no other validations will occur) the InArrayValidation keeps working on any Linux mahine, but on Windows is even more weird. When we call $form->getData() that element has been removed, as if it wasen't added to the form in the first place.

We are getting out of ideas. Is there any incompatibility with windows?

We have checked
Ubuntu + PHP5.5 + ZF2.3 -> Works as expected
Ubuntu + PHP5.4 + ZF2.3 -> Works as expected
Windows 7 + PHP5.4 + ZF2.3 -> Weird errors.

Thank you very much.

--
Alejandro Celaya Alastrué


Reply | Threaded
Open this post in threaded view
|

Re: Form validation in Windows

Alejandro Celaya

Sorry, I sent this message some minutes ago but missed to include the list address

***
I'm sorry, I was really asking if there is any known issue. 
I will send you some code snippets as soon as I get home.

Thanks!
***

--
Alejandro Celaya Alastrué
www.alejandrocelaya.com

El 20/06/2014 16:08, "Phillip Harrington" <[hidden email]> escribió:
Can you post a gist with a baseline test - everything necessary to reproduce but no extra stuff?

On Fri, Jun 20, 2014 at 9:49 AM, Gary Hockin <[hidden email]> wrote:

I am only guessing, but do you have a case mismatch somewhere? 



On Fri, Jun 20, 2014 at 2:21 PM, Alejandro Celaya <[hidden email]> wrote:
Hi folks.

In my company we are having a weird problem.
We have a Form with a Select element with 4 value options.
It is properly validated (an InArrayValidator is included) when we test it in any development machine with Linux, but one of us is using Windows. In his machine invalid values pass as they were valid.
If we remove the element from the InputFilter (asuming no other validations will occur) the InArrayValidation keeps working on any Linux mahine, but on Windows is even more weird. When we call $form->getData() that element has been removed, as if it wasen't added to the form in the first place.

We are getting out of ideas. Is there any incompatibility with windows?

We have checked
Ubuntu + PHP5.5 + ZF2.3 -> Works as expected
Ubuntu + PHP5.4 + ZF2.3 -> Works as expected
Windows 7 + PHP5.4 + ZF2.3 -> Weird errors.

Thank you very much.

--
Alejandro Celaya Alastrué


Reply | Threaded
Open this post in threaded view
|

Re: Form validation in Windows

Alejandro Celaya
Hello.
Sorry for the delay. I was preparing a small example removing all the elements not related and simplifying it as much as possible.
There is no factories either, as the dependency injection doesn't look to be the problem.


This is the case.
We have a Collection element which is not required. It is composed by a Fieldset, which in turn is composed by a Select element and a Text element.
The Select in the fieldset has 4 possible values that should be validated by the InArryValidator included on it.

Just as the example is right now, on Windows, if the input data is something like this

$form = new TheForm(new TheInputFilter());
$form->setData(array(
    TheForm::DESCRIPTIONS => array(
        array(
            TranslationFieldset::LANGUAGE => "en",
            TranslationFieldset::MESSAGE => "The message"
        ),
        array(
            TranslationFieldset::LANGUAGE => "es",
            TranslationFieldset::MESSAGE => "El mensaje"
        ),
    )
));

The form is valid, but when you call getData() the languages are missing (????)

$form->getData()
// This returns something like this
array(
    'descriptions' => array(
        array(
            'message' => 'The message'
        ),
        array(
            'message' => 'El mensaje'
        ),
    )
)

Otherwise, if I use TheOtherInputFilter instead of TheInputFilter, which creates a Zend\InputFilter\Input for the language, then it is present when calling getData() as expected, but in this case the problem is that any value is valid for the language, as if it didn't have an InArrayValidator.

Both examples work as expected in other Linux machines.

Let me know if someone is able to reproduce it. In the meantime I'm trying to reproduce it in another Windows machine, but I need to prepare the environment.
Thank you very much!


2014-06-20 16:10 GMT+02:00 Alejandro Celaya <[hidden email]>:

Sorry, I sent this message some minutes ago but missed to include the list address

***
I'm sorry, I was really asking if there is any known issue. 


I will send you some code snippets as soon as I get home.

Thanks!
***

--
Alejandro Celaya Alastrué
www.alejandrocelaya.com

El 20/06/2014 16:08, "Phillip Harrington" <[hidden email]> escribió:

Can you post a gist with a baseline test - everything necessary to reproduce but no extra stuff?

On Fri, Jun 20, 2014 at 9:49 AM, Gary Hockin <[hidden email]> wrote:

I am only guessing, but do you have a case mismatch somewhere? 



On Fri, Jun 20, 2014 at 2:21 PM, Alejandro Celaya <[hidden email]> wrote:
Hi folks.

In my company we are having a weird problem.
We have a Form with a Select element with 4 value options.
It is properly validated (an InArrayValidator is included) when we test it in any development machine with Linux, but one of us is using Windows. In his machine invalid values pass as they were valid.
If we remove the element from the InputFilter (asuming no other validations will occur) the InArrayValidation keeps working on any Linux mahine, but on Windows is even more weird. When we call $form->getData() that element has been removed, as if it wasen't added to the form in the first place.

We are getting out of ideas. Is there any incompatibility with windows?

We have checked
Ubuntu + PHP5.5 + ZF2.3 -> Works as expected
Ubuntu + PHP5.4 + ZF2.3 -> Works as expected
Windows 7 + PHP5.4 + ZF2.3 -> Weird errors.

Thank you very much.

--
Alejandro Celaya Alastrué





--
Alejandro Celaya Alastrué
Reply | Threaded
Open this post in threaded view
|

Re: Form validation in Windows

Alejandro Celaya
Hello again.
I finally got the time to test this myself in a Windows machine and it's definitely happening.

I fixed two typos in the previous gist (https://gist.github.com/acelaya/78970ed8f428edc8dda8) and used that example.
The error I explained in the last message is produced only on Windows platforms. For no reason, one of the Fieldset values is missing when calling $form->getData(), but only on Windows (WTF!).

I tested that example in Windows 7 + PHP 5.5 + ZF 2.3 (with xampp) -> the error is produced.
Then I tested the same example (the exact same file in the exact same project) in an Ubuntu 14.04 + PHP 5.5 + ZF 2.3 -> everything worked as expected.

I will try to dig into the Zend Framework code because this seems like a bug. Don't know if it's a PHP bug on WIndows, a xampp bug or a Zend Framework bug, but the behavior is clearly inconsistent.
Any help will be very apreciated. If anyone more used to work on Windows could do the test I would be very gratefull.

Best regards!


2014-06-22 12:37 GMT+02:00 Alejandro Celaya <[hidden email]>:
Hello.
Sorry for the delay. I was preparing a small example removing all the elements not related and simplifying it as much as possible.
There is no factories either, as the dependency injection doesn't look to be the problem.


This is the case.
We have a Collection element which is not required. It is composed by a Fieldset, which in turn is composed by a Select element and a Text element.
The Select in the fieldset has 4 possible values that should be validated by the InArryValidator included on it.

Just as the example is right now, on Windows, if the input data is something like this

$form = new TheForm(new TheInputFilter());
$form->setData(array(
    TheForm::DESCRIPTIONS => array(
        array(
            TranslationFieldset::LANGUAGE => "en",
            TranslationFieldset::MESSAGE => "The message"
        ),
        array(
            TranslationFieldset::LANGUAGE => "es",
            TranslationFieldset::MESSAGE => "El mensaje"
        ),
    )
));

The form is valid, but when you call getData() the languages are missing (????)

$form->getData()
// This returns something like this
array(
    'descriptions' => array(
        array(
            'message' => 'The message'
        ),
        array(
            'message' => 'El mensaje'
        ),
    )
)

Otherwise, if I use TheOtherInputFilter instead of TheInputFilter, which creates a Zend\InputFilter\Input for the language, then it is present when calling getData() as expected, but in this case the problem is that any value is valid for the language, as if it didn't have an InArrayValidator.

Both examples work as expected in other Linux machines.

Let me know if someone is able to reproduce it. In the meantime I'm trying to reproduce it in another Windows machine, but I need to prepare the environment.
Thank you very much!


2014-06-20 16:10 GMT+02:00 Alejandro Celaya <[hidden email]>:

Sorry, I sent this message some minutes ago but missed to include the list address

***
I'm sorry, I was really asking if there is any known issue. 


I will send you some code snippets as soon as I get home.

Thanks!
***

--
Alejandro Celaya Alastrué
www.alejandrocelaya.com

El 20/06/2014 16:08, "Phillip Harrington" <[hidden email]> escribió:

Can you post a gist with a baseline test - everything necessary to reproduce but no extra stuff?

On Fri, Jun 20, 2014 at 9:49 AM, Gary Hockin <[hidden email]> wrote:

I am only guessing, but do you have a case mismatch somewhere? 



On Fri, Jun 20, 2014 at 2:21 PM, Alejandro Celaya <[hidden email]> wrote:
Hi folks.

In my company we are having a weird problem.
We have a Form with a Select element with 4 value options.
It is properly validated (an InArrayValidator is included) when we test it in any development machine with Linux, but one of us is using Windows. In his machine invalid values pass as they were valid.
If we remove the element from the InputFilter (asuming no other validations will occur) the InArrayValidation keeps working on any Linux mahine, but on Windows is even more weird. When we call $form->getData() that element has been removed, as if it wasen't added to the form in the first place.

We are getting out of ideas. Is there any incompatibility with windows?

We have checked
Ubuntu + PHP5.5 + ZF2.3 -> Works as expected
Ubuntu + PHP5.4 + ZF2.3 -> Works as expected
Windows 7 + PHP5.4 + ZF2.3 -> Weird errors.

Thank you very much.

--
Alejandro Celaya Alastrué





--
Alejandro Celaya Alastrué



--
Alejandro Celaya Alastrué
Reply | Threaded
Open this post in threaded view
|

Re: Form validation in Windows

Alejandro Celaya
Hi guys.
I finally found the problem.

Our form is much more complex than the example I sent you. The problem was that "someone" defined twice the CollectionInputFilter for the descriptions. In the second one the language (the property that was being removed after validation) wasn't defined in the InputFilter assigned to that CollectionInputFilter, but it was in the first one. On Linux that seemed to work, but on Windows that language disappeared. It's an inconsistent behavior, but the bug was on our code.

Thank you all and sorry for the "spam" of the last days.


2014-08-03 11:17 GMT+02:00 Alejandro Celaya <[hidden email]>:
Hello again.
I finally got the time to test this myself in a Windows machine and it's definitely happening.

I fixed two typos in the previous gist (https://gist.github.com/acelaya/78970ed8f428edc8dda8) and used that example.
The error I explained in the last message is produced only on Windows platforms. For no reason, one of the Fieldset values is missing when calling $form->getData(), but only on Windows (WTF!).

I tested that example in Windows 7 + PHP 5.5 + ZF 2.3 (with xampp) -> the error is produced.
Then I tested the same example (the exact same file in the exact same project) in an Ubuntu 14.04 + PHP 5.5 + ZF 2.3 -> everything worked as expected.

I will try to dig into the Zend Framework code because this seems like a bug. Don't know if it's a PHP bug on WIndows, a xampp bug or a Zend Framework bug, but the behavior is clearly inconsistent.
Any help will be very apreciated. If anyone more used to work on Windows could do the test I would be very gratefull.

Best regards!


2014-06-22 12:37 GMT+02:00 Alejandro Celaya <[hidden email]>:

Hello.
Sorry for the delay. I was preparing a small example removing all the elements not related and simplifying it as much as possible.
There is no factories either, as the dependency injection doesn't look to be the problem.


This is the case.
We have a Collection element which is not required. It is composed by a Fieldset, which in turn is composed by a Select element and a Text element.
The Select in the fieldset has 4 possible values that should be validated by the InArryValidator included on it.

Just as the example is right now, on Windows, if the input data is something like this

$form = new TheForm(new TheInputFilter());
$form->setData(array(
    TheForm::DESCRIPTIONS => array(
        array(
            TranslationFieldset::LANGUAGE => "en",
            TranslationFieldset::MESSAGE => "The message"
        ),
        array(
            TranslationFieldset::LANGUAGE => "es",
            TranslationFieldset::MESSAGE => "El mensaje"
        ),
    )
));

The form is valid, but when you call getData() the languages are missing (????)

$form->getData()
// This returns something like this
array(
    'descriptions' => array(
        array(
            'message' => 'The message'
        ),
        array(
            'message' => 'El mensaje'
        ),
    )
)

Otherwise, if I use TheOtherInputFilter instead of TheInputFilter, which creates a Zend\InputFilter\Input for the language, then it is present when calling getData() as expected, but in this case the problem is that any value is valid for the language, as if it didn't have an InArrayValidator.

Both examples work as expected in other Linux machines.

Let me know if someone is able to reproduce it. In the meantime I'm trying to reproduce it in another Windows machine, but I need to prepare the environment.
Thank you very much!


2014-06-20 16:10 GMT+02:00 Alejandro Celaya <[hidden email]>:

Sorry, I sent this message some minutes ago but missed to include the list address

***
I'm sorry, I was really asking if there is any known issue. 


I will send you some code snippets as soon as I get home.

Thanks!
***

--
Alejandro Celaya Alastrué
www.alejandrocelaya.com

El 20/06/2014 16:08, "Phillip Harrington" <[hidden email]> escribió:

Can you post a gist with a baseline test - everything necessary to reproduce but no extra stuff?

On Fri, Jun 20, 2014 at 9:49 AM, Gary Hockin <[hidden email]> wrote:

I am only guessing, but do you have a case mismatch somewhere? 



On Fri, Jun 20, 2014 at 2:21 PM, Alejandro Celaya <[hidden email]> wrote:
Hi folks.

In my company we are having a weird problem.
We have a Form with a Select element with 4 value options.
It is properly validated (an InArrayValidator is included) when we test it in any development machine with Linux, but one of us is using Windows. In his machine invalid values pass as they were valid.
If we remove the element from the InputFilter (asuming no other validations will occur) the InArrayValidation keeps working on any Linux mahine, but on Windows is even more weird. When we call $form->getData() that element has been removed, as if it wasen't added to the form in the first place.

We are getting out of ideas. Is there any incompatibility with windows?

We have checked
Ubuntu + PHP5.5 + ZF2.3 -> Works as expected
Ubuntu + PHP5.4 + ZF2.3 -> Works as expected
Windows 7 + PHP5.4 + ZF2.3 -> Weird errors.

Thank you very much.

--
Alejandro Celaya Alastrué





--
Alejandro Celaya Alastrué



--
Alejandro Celaya Alastrué



--
Alejandro Celaya Alastrué