Bug #18643
closed
TypoScript Constant Editor produces PHP Warning: ereg() Invalid preceding regular expression in class.t3lib_tsparser_ext.php
Added by LUBRANO J.F. over 16 years ago.
Updated about 6 years ago.
Description
I am training with "typo 3 pour les nuls" and when I try to build a custom template (see page 20) access to template/constant editor fire the following message :
Warning: ereg() [function.ereg]: Invalid preceding regular expression in /home.10/swisscot/www/cms/t3lib/class.t3lib_tsparser_ext.php on line 1099
looking to line 1099 in class.t3lib_tsparser_ext.php I see :
if (ereg('^{[\$][a-zA-Z0-9\.]*}$',trim($fV),$reg))
The regular expression seems to be strange. Trying to replace "{" with "("
and "}" with ")" suppress the message
Is it a good solution ?
P.S. I am not specialist with PHP and regular expressions
(issue imported from #M8161)
Files
Finally, I think,replacing "{" with "(" and "}" with ")", is not a good idea ... Searching Bugtrack I find a report (ID=1043) with a similar problem.
Now I replace "{" with "\{" and "}" with "\}" (escaping sequence) and the result is better.
If somebody can give an advice on the method ...
How does your own constant template look like?
The attached patch rewrites the ereg call to a preg_match call (as clean up).
However I could not reproduce the behaviour you mentioned.
hello,
Even if this bug is quite old, I can reproduce this behaviour.
On a fresh clean typo3 4.2.2 installation, with a very simple typoscript template (only a page object, with 1 suboject).
-If i use like that, there is no problem with the constant editor.
-If I add to this typoscript template in the part "include static from extension" the template "css_style_content", and go back to the constant editor, I now see LOTS of messages like this on :
Warning: ereg() [function.ereg]: Invalid preceding regular expression in /...../..../www/t3lib/class.t3lib_tsparser_ext.php on line 1104
Last thing, I've T3editor extension enabled.
I hope that could help.
Confirmation of the bug.
Patch of Olivier resolves the problem.
Looks like limited configuration of PHP.
The code has been changed to use preg_match for issue #19728.
Is the error still reproducable for you?
No feedback given. Besides that I could not find the mentioned code part anymore (due to other fixes in between).
- Status changed from Resolved to Closed
Also available in: Atom
PDF