Bug #52904

Namespace problem in JS when extending TCA evalfields

Added by Thomas Löffler over 8 years ago. Updated about 4 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Backend User Interface
Target version:
Start date:
2013-10-16
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
6.2
PHP Version:
5.4
Tags:
Complexity:
Is Regression:
No
Sprint Focus:

Description

I extend the TCA evaluators for the be_users passwords with my extension and rewritten it with namespaces.
In the TCA field I have to set the complete namespace to get it work in PHP, but in JS it's broken now.

TCA:

$TCA['be_users']['columns']['password']['config']['eval'] = 'trim,required,SpoonerWeb\\BeSecurePw\\Evaluation\\PasswordEvaluator,tx_saltedpasswords_eval_be,password';

Result in JS (jsfunc.tbe_editor.js) when debugging "evallist" in line 640:
'trim,required,SpoonerWebBeSecurePwEvaluationPasswordEvaluator,tx_saltedpasswords_eval_be,password'

It breaks the complete JS functionality and no fields are filled with data from the database.

Either we have to change the integration for the eval fields or JS has to know how to handle the namespace in this case.

To reproduce it you can install the extension be_secure_pw (master) on:

https://github.com/spoonerWeb/be_secure_pw

#1

Updated by Stefan Aebischer about 8 years ago

The namespaced eval function generates an invalid javascript function name "function SpoonerWeb\BeSecurePw\Evaluation\PasswordEvaluator(newValue)". In chrome this breaks all the TBE_EDITOR definitions and with that all the functionality in jsfunc.tbe_editor.js.

This diff was a quick try to solve the bug. Unfortunately it is not well tested and i have no idea what regressions it could introduce. Therefore it is not ready for a gerrit PR. I posted it anyway because it could lead the guys with a deeper understanding of the TYPO3 BE form internals, where to get their hands dirty.
https://gist.github.com/pAlpha627/7092156

Indeed it would be nice, to have a possibility to use namespaced "eval" functions. At least there should be some syntax checks for the generated Javascript in TYPO3\CMS\Backend\Form\FormEngine, in oder to avoid breaking the whole functionality.

BTW: As of now the master branch of be_secure_pw contained only "PasswordEvaluator" and not "SpoonerWeb\\BeSecurePw\\Evaluation\\PasswordEvaluator" as mentioned in the Bug report. In order to reproduce the bug you have to change the $TCA['be_users']['columns']['password']['config']['eval'] in be_secure_pw/ext_tables.php.

#2

Updated by Thomas Löffler about 8 years ago

Thanks for the patch. I will have a look on it.
Yes, I thought I pushed the last commit, but I've seen that I forgot to do it. :)

#3

Updated by Thomas Löffler about 8 years ago

Hi Stefan,

this patch works for me and is not breaking any functionality of other evaluators.
I would suggest to push it to Gerrit. The reviewing people will have corrections for the code, if there are any. :)

Will you push it or should I?

Thomas

#4

Updated by Gerrit Code Review about 8 years ago

  • Status changed from New to Under Review

Patch set 1 for branch master has been pushed to the review server.
It is available at https://review.typo3.org/25041

#5

Updated by Stefan Aebischer about 8 years ago

Will you push it or should I?

Hi Thomas fine for me if you push it

Stefan

#6

Updated by Gerrit Code Review about 8 years ago

Patch set 2 for branch master has been pushed to the review server.
It is available at https://review.typo3.org/25041

#7

Updated by Gerrit Code Review about 8 years ago

Patch set 3 for branch master has been pushed to the review server.
It is available at https://review.typo3.org/25041

#8

Updated by Gerrit Code Review about 8 years ago

Patch set 4 for branch master has been pushed to the review server.
It is available at https://review.typo3.org/25041

#9

Updated by Gerrit Code Review about 8 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/25041

#10

Updated by Gerrit Code Review about 8 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/25041

#11

Updated by Thomas Löffler about 8 years ago

Reproduction:
#12

Updated by Gerrit Code Review about 8 years ago

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

#13

Updated by Gerrit Code Review about 8 years ago

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

#14

Updated by Anonymous about 8 years ago

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

Updated by Riccardo De Contardi about 4 years ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF