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

Symphony warning when datetime field is both required and empty/invalid #2303

Closed
johnpuddephatt opened this Issue Jan 5, 2015 · 6 comments

Comments

Projects
None yet
3 participants
@johnpuddephatt

johnpuddephatt commented Jan 5, 2015

I have a required DateTime field with date ranges enabled.

When content is submitted through a frontend form, the following error is returned if both start and end values are missing/invalid:

Symphony Warning: trim() expects parameter 1 to be string, array given
The error originates from line 191 of class.event.section.php.

I've had a quick look and think I can roughly figure out what's happening - it appears the datetime values being tested are 2D arrays, so although array_reduce is used on line 86, trim is still acting upon an array (one-dimensional), hence the error. At least that's what I think is going on.

p.s. I've hacked together a workaround for now, but can't quite figure out a proper solution. My PHP is quite limited...

@brendo

This comment has been minimized.

Show comment
Hide comment
@brendo

brendo Jan 5, 2015

Member

Is this the actual DateTime field or the core Date field? Assuming the first?

Also, which version of Symphony are you running?

Member

brendo commented Jan 5, 2015

Is this the actual DateTime field or the core Date field? Assuming the first?

Also, which version of Symphony are you running?

@johnpuddephatt

This comment has been minimized.

Show comment
Hide comment
@johnpuddephatt

johnpuddephatt Jan 5, 2015

Sorry, I should have been clearer: yes the DateTime field. I wasn't sure whether it was the extension or the core at fault so it was 50-50 whether I posted there or here.

Oh, and version 2.5.2. With the latest version of DateTime (3.4.3)

johnpuddephatt commented Jan 5, 2015

Sorry, I should have been clearer: yes the DateTime field. I wasn't sure whether it was the extension or the core at fault so it was 50-50 whether I posted there or here.

Oh, and version 2.5.2. With the latest version of DateTime (3.4.3)

@brendo brendo self-assigned this Jan 7, 2015

@brendo brendo added this to the 2.6.0 milestone Jan 7, 2015

@brendo

This comment has been minimized.

Show comment
Hide comment
@brendo

brendo Jan 7, 2015

Member

No worries. At first look, it's a Symphony issue, so good work on the coin toss ;)

Member

brendo commented Jan 7, 2015

No worries. At first look, it's a Symphony issue, so good work on the coin toss ;)

@nitriques

This comment has been minimized.

Show comment
Hide comment
@nitriques

nitriques Jan 7, 2015

Member

@johnpuddephatt Does @brendo's commit fixes your issue ?

Member

nitriques commented Jan 7, 2015

@johnpuddephatt Does @brendo's commit fixes your issue ?

@johnpuddephatt

This comment has been minimized.

Show comment
Hide comment
@johnpuddephatt

johnpuddephatt Jan 7, 2015

Appears to have done the trick, yes.

Thanks 👍

johnpuddephatt commented Jan 7, 2015

Appears to have done the trick, yes.

Thanks 👍

@nitriques

This comment has been minimized.

Show comment
Hide comment
@nitriques

nitriques Jan 7, 2015

Member

Great!

Member

nitriques commented Jan 7, 2015

Great!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment