Project

General

Profile

Actions

Bug #80197

closed

EXT:form - label with periods causes PHP warning

Added by Björn Jacob about 7 years ago. Updated over 5 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Form Framework
Target version:
-
Start date:
2017-03-08
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
8
PHP Version:
Tags:
Complexity:
Is Regression:
No
Sprint Focus:
Remote Sprint

Description

When using a select field and the label of an option contains a period, the SelectVH throws an exception: 1476107295: PHP Warning: get_class() expects parameter 1 to be object, array given in ...ypo3/sysext/fluid/Classes/ViewHelpers/Form/SelectViewHelper.php line 219.


Related issues 2 (0 open2 closed)

Related to TYPO3 Core - Bug #81961: EXT:form If values in single select field contains dots (f.e. emails) JS saving and rendering fails. Closed2017-07-25

Actions
Related to TYPO3 Core - Bug #82210: ext:form multi checkbox values containing . or & result in empty frontend labelsClosed2017-08-25

Actions
Actions #1

Updated by Claus Due about 7 years ago

  • Category changed from Fluid to Form Framework

This is by design - if a patch should be made, it should be in EXT:form and should throw errors or use another method to prevent dots from being used in field names.

The same applies when you're making an Extbase plugin: a dotted field name has implicit meaning to Extbase's mapper and means you want to address a sub-property by path. So, `f:form.select` (and others!) cannot be used this way.

Category changed to Form Framework to allow others to evaluate how to prevent this.

Actions #2

Updated by Björn Jacob about 7 years ago

  • Subject changed from EXT:form - label with periods cazses PHP warning to EXT:form - label with periods causes PHP warning

Thx Claus for your feedback. We will think about handling this issue. Maybe just add this to the documentation. We want to be as close as possible to the default behaviour ;)

Actions #3

Updated by Ralf Zimmermann almost 7 years ago

  • Status changed from New to Needs Feedback
  • Assignee set to Björn Jacob

I cannot confirm this for 8.7.2 and 9.0.0-dev.

        type: SingleSelect
        identifier: singleselect-1
        label: 'Single select'
        properties:
          options:
            bar.foo: 12.12.2012

The select-option label and value contains dots and the frontend renders this without any PHP warnings or errors.
Could you please provide a form definition to reproduce this issue?

Actions #4

Updated by Riccardo De Contardi over 6 years ago

  • Status changed from Needs Feedback to New

I just tried with the latest master, and added a "single select options" field with the following options (label|value):

te,st | te,st
te.st | te.st
te;st | te;st
te,st.st;st | te,st.st;st

Saving the form went without errors, and so the frontend display, but... when I tried to edit again the form with the form module, it is not loading anymore (infinite spinning loading). I checked with chrome console for errors and found:

Uncaught TypeError: Cannot create property 'st;st' on string 'te,st'
    at Object.set (Core.js?bust=4a2d0c1…:812)
    at extendModel (Core.js?bust=4a2d0c1…:722)
    at extendModel (Core.js?bust=4a2d0c1…:720)
    at extendModel (Core.js?bust=4a2d0c1…:720)
    at createModel (Core.js?bust=4a2d0c1…:982)
    at createFormElement (Core.js?bust=4a2d0c1…:1820)
    at createFormElement (Core.js?bust=4a2d0c1…:1878)
    at createFormElement (Core.js?bust=4a2d0c1…:1878)
    at createFormElement (Core.js?bust=4a2d0c1…:1878)
    at Object.createFormElement (Core.js?bust=4a2d0c1…:1878)

I also peeked at the .yaml file and found:

[...]
                properties:
                  options:
                    'te,st': 'te,st'
                    te.st: te.st
                    te;st: te;st
                    'te,st.st;st': 'te,st.st;st'
                  prependOptionLabel: 'te,st'
                type: SingleSelect
                identifier: singleselect-1
                label: 'Single select'
[...]
Actions #5

Updated by Riccardo De Contardi over 6 years ago

  • Related to Bug #81961: EXT:form If values in single select field contains dots (f.e. emails) JS saving and rendering fails. added
Actions #6

Updated by Björn Jacob over 6 years ago

  • Assignee deleted (Björn Jacob)
  • Sprint Focus set to Remote Sprint
Actions #7

Updated by Björn Jacob over 6 years ago

  • Related to Bug #82210: ext:form multi checkbox values containing . or & result in empty frontend labels added
Actions #8

Updated by Daniel Lorenz over 6 years ago

This is only happen when the value contains a dot. Labels with dots seems to work.

test1: test.test
test2: test,test
test3: test;test
test4: test,test.test;test

The option

test1.test2: test3

is interpreted as "test1" for the value, and "[object Object]" for the label.

Actions #9

Updated by Gerrit Code Review over 6 years ago

  • Status changed from New to Under Review

Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/53956

Actions #10

Updated by Gerrit Code Review over 6 years ago

Patch set 2 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/53956

Actions #11

Updated by Gerrit Code Review over 6 years ago

Patch set 3 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/53956

Actions #12

Updated by Gerrit Code Review over 6 years ago

Patch set 4 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/53956

Actions #13

Updated by Gerrit Code Review over 6 years ago

Patch set 5 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/53956

Actions #14

Updated by Gerrit Code Review over 6 years ago

Patch set 6 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/53956

Actions #15

Updated by Oliver Hader over 6 years ago

The PHP warning is the result of the YAML is incorrectly persisted (after saving twice from the wizard).

e.g.

options:
  what.ever: what.ever

becomes

options:
  what:
    ever: what.ever

In this case, the YAML has to be adjusted again.

Actions #16

Updated by Ralf Zimmermann over 6 years ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100
Actions #17

Updated by Gerrit Code Review over 6 years ago

  • Status changed from Resolved to Under Review

Patch set 1 for branch TYPO3_8-7 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/53984

Actions #18

Updated by Ralf Zimmermann over 6 years ago

  • Status changed from Under Review to Resolved
Actions #19

Updated by Benni Mack over 5 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF