22580[TASK] PHP-functionality instead of GeneralUtility::deHSCentities
Commit message
Review
-
Code review CR +2
- Anja Leichsenring +2
- Alexander Opitz +1
- Pascal Dürsteler +1
- Markus Klein +1
- Stefan Froemken +1
-
Verified V +2
- Anja Leichsenring +2
- Alexander Opitz +1
- Markus Klein +1
Issues 1
Files 10
- typo3/sysext/backend/Classes/Form/FormEngine.php4+7 −7
- typo3/sysext/backend/Classes/Template/DocumentTemplate.php+1 −1
- typo3/sysext/backend/Classes/Utility/BackendUtility.php+1 −1
- typo3/sysext/core/Classes/Html/HtmlParser.php4+6 −5
- typo3/sysext/core/Classes/Utility/GeneralUtility.php1+3 −0
- typo3/sysext/feedit/Classes/FrontendEditPanel.php+1 −1
- typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php1+4 −3
- typo3/sysext/frontend/Classes/ContentObject/FormContentObject.php+2 −2
- typo3/sysext/perm/Classes/Controller/PermissionModuleController.php+1 −1
- typo3/sysext/rtehtmlarea/Classes/RteHtmlAreaBase.php+1 −1
Review log 57
Show 32 earlier messages
-
Mr. Jenkins commented on patch set 1 07/25/13, 23:06
Build Successful https://ci.typo3.org/job/typo3-v4-core-gerrit/9731/ : SUCCESS -
Stefan Neufeind commented on patch set 1 07/25/13, 23:17
I just found in the docs that before PHP 5.4.0 the charset defaulted to ISO-8859-1 and since then to UTF-8. So this patch actually changes things a bit. But we (meanwhile) always use UTF-8 internally anyway. So I guess this is okay/correct? To be "even more correct" we'd need to explicitly mention UTF-8 in other places where htmlspecialchars() is used. And this ENT_HTML401 is the default. But also ENT_HTML5 exists. Do we need to take that into account as well? But that's not something that changes with this patch and which we should imho track separately if desired (please file an issue on forge). -
Markus Klein commented on patch set 1 07/25/13, 23:39
The docs also say: For the purposes of this function, the encodings ISO-8859-1, ISO-8859-15, UTF-8, cp866, cp1251, cp1252, and KOI8-R are effectively equivalent, provided the string itself is valid for the encoding, as the characters affected by htmlspecialchars() occupy the same positions in all of these encodings. Therefore we don't need to change all occurrences of htmlspecialchars() -
Stefan Neufeind commented on patch set 1 07/25/13, 23:46
@Markus: Thanks for the clarification. You are right. It would just make a difference for htmlentities where Umlauts would have a different encoding. But that's not used in the core, just htmlspecialchars(). -
Wouter Wolters commented on patch set 1 CR -1 07/26/13, 17:01
Update will followFormEngine.php:1874here also:) -
Wouter Wolters commented on patch set 1 CR +1 07/26/13, 17:20
Discussed with Stefan by Skype. This is the last call to this funcion from the core. Only fact is that this parameter does not have htmlspecialchars applied to it. -
Stefan Neufeind uploaded patch set 2 08/18/13, 13:35
-
Mr. Jenkins commented on patch set 2 08/18/13, 13:36
Build Successful https://ci.typo3.org/job/typo3-v4-core-gerrit/10133/ : SUCCESS -
Sebastian Fischer voted on patch set 2 CR +1 10/25/13, 07:21
-
Stefan Neufeind commented on patch set 2 11/12/13, 14:41
ping -
Pascal Dürsteler voted on patch set 2 CR +1 11/12/13, 14:43
-
Benni Mack uploaded patch set 3 11/20/13, 13:11
-
Sebastian Fischer voted on patch set 3 CR +1 11/20/13, 13:22
-
Mr. Jenkins commented on patch set 3 11/20/13, 13:31
Build Successful https://ci.typo3.org/job/typo3-v4-core-gerrit/12210/ : SUCCESS -
Stefan Neufeind commented on patch set 3 12/18/13, 11:49
Maybe a bigger changeset, but not a big change in itself imho. Looking forward to your feedback. -
Markus Klein commented on patch set 3 V +1 CR +1 12/18/13, 12:41
Didn't notice any problems -
Helmut Hummel commented on patch set 3 CR -1 12/18/13, 22:49
There are unit tests for deHSCentities in GeneralUtilityTest that should be removed, or even better moved like suggested in the code commentHtmlParser.php:986This change looks easy enough to get a unit test that shows that the changed code keeps the current results. Maybe move the deHSCentities tests that are still left to HtmlParser which checks exactly this caseGeneralUtility.php:1008use .... to avoid double encoding instead -
Michiel Roos commented on patch set 3 01/06/14, 22:38
HtmlParser.php:987Change the next lines with a call to \TYPO3\CMS\Core\Utility\GeneralUtility::htmlspecialchars_decode() -
Michiel Roos commented on patch set 3 01/06/14, 23:06
HtmlParser.php:982This method should be renamed to bidirectionalHtmlspecialchars. Furthermore, the method \TYPO3\CMS\Core\Html\HtmlParser::processContent() could be removed since it's just a wrapper for this method. But that would make the HTMLcleaner less readable (the only caller in the core), so that may not be the best cleanup idea. -
Stefan Neufeind uploaded patch set 4 01/30/14, 14:29
-
Stefan Neufeind commented on patch set 4 V -1 01/30/14, 14:31
!!! please see tests for bidir_htmlspecialchars() in HtmlParser Tests for "Single encoded entities are not touched" fails. Hmm, but does that usecase really make sense? For bidir_... we also need to add a testcase for "dir == 2" *wtf* Does htmlspecialchars_decode() as we have it in GeneralUtility really make sense? It does what the function PHP has since 5.1.0 (same name) is supposed to do - but only works on a subset of replacements?!? -
Stefan Neufeind commented on patch set 4 01/30/14, 14:33
And if we can really get rid of htmlspecialchars_decode() in GeneralUtility, there are some more cases where it is currently used and we could then cleanly deprecate it. -
Mr. Jenkins commented on patch set 4 01/30/14, 19:30
Build Successful https://ci.typo3.org/job/typo3-v4-core-gerrit/13365/ : SUCCESS -
Michiel Roos commented on patch set 4 CR -1 02/03/14, 12:02
ENT_HTML401 was added in PHP 5.4. The minimal version we need to support would be 5.3. -
Stefan Neufeind commented on patch set 4 02/03/14, 12:11
Michiel, thanks for finding this. Yes okay, we need a solution for that part then. ENT_HTML401 was just added to the htmlspecialchars()-call to be able to specify some parameter after that. So if I see right we'd need to use just ENT_COMPAT for below PHP 5.4 and add ENT_HTML401 for everything above, to still go with the default-behaviour of htmlspecialchars()? Or is HTML401 the right behaviour anyway? Would we like to use the HTML5-mode maybe if we are on above 5.4? What worries me a bit in this context is that so far we used htmlspecialchars() without thinking deeper what various encoding-formats are available. (Maybe they only have small variations anyway?) -
Michiel Roos commented on patch set 4 02/03/14, 12:53
Yes, I think staying with ENT_COMPAT is fine for now. The rest depends on context. Most of the backend is not HTML5 I think? So there HTML4 would make sense. For the frontend we don't know. There we would need case structures to decide based upon the TypoScript config. But I wonder what difference the masks make between HTML4 and 5. We should get a clear picture of that before adding more fancy code. But as 5.3 is the baseline, go for ENT_COMPAT only for now. -
Jigal van Hemert commented on patch set 4 CR -1 02/05/14, 07:59
http://stackoverflow.com/questions/13745353/what-do-the-ent-html5-ent-html401-modifiers-on-html-entity-decode-do Someone did the research for us and dug into the PHP sources. - ENT_* : for htmlspecialchars it's safe to keep the default; the difference between ENT_HTML401 and ENT_HTML5 seems to be that a single quote - charset : Important for this is "By default, byte sequences that are invalid for the given character set are removed." For ISO-8859-x all byte sequences are valid; it's a full 256 character set. Because we use UTF-8 internally the UTF-8 charset for htmlspecialchars() can equally well be used. All in all there is no need to specify any extra parameters with TYPO3 and we can just stick to the defaults provided by PHP. Just to be sure it would be a good idea to have unit tests which contain the characters which are to be encoded and some UTF-8 characters which are encoded with two and three bytes per character. If these all work the simplest solution should be used IMO. -
Stefan Neufeind commented on patch set 4 02/05/14, 09:56
@Jigal: So in case we need to specify "the default-values" to reach the PHP-parameter behind it *sigh* (the boolean) we could then just use ENT_COMPAT which is a baseline for PHP 5.3 (there it was the default) and the versions after 5.3 (have HTML401 as default but that's not important to us) right? If we add ENT_HTML401 we won't be able to run it under 5.3 - but if I understand right we don't need a version-dependent switch since ENT_COMPAT would be enough ... and we'd have the same behaviour (for testing) in 5.3 and with 5.4. utf8 everywhere ... great :-) -
Stefan Neufeind uploaded patch set 5 02/05/14, 11:52
-
Stefan Neufeind commented on patch set 5 02/05/14, 11:53
moved to ENT_COMPAT -
Markus Klein commented on patch set 5 CR +1 02/05/14, 12:02
HtmlParser.php:993one space too much after =ContentObjectRenderer.php:2899maybe add a empty() check here -
Mr. Jenkins commented on patch set 5 02/05/14, 12:07
Build Successful https://ci.typo3.org/job/typo3-v4-core-gerrit/13718/ : SUCCESS https://ci.typo3.org/job/typo3-v4-core-gerrit/13717/ : SUCCESS
-
Stefan Neufeind uploaded patch set 6 02/05/14, 12:18
-
Stefan Neufeind commented on patch set 6 02/05/14, 12:19
Thanks Markus, took care of your comments. -
Markus Klein voted on patch set 6 CR +1 02/05/14, 12:21
-
Mr. Jenkins commented on patch set 6 02/05/14, 12:32
Build Successful https://ci.typo3.org/job/typo3-v4-core-gerrit/13719/ : SUCCESS https://ci.typo3.org/job/typo3-v4-core-gerrit/13718/ : SUCCESS -
Stefan Neufeind commented on patch set 6 02/16/14, 16:27
ping? -
Stefano Kowalke voted on patch set 6 CR +1 02/17/14, 08:23
-
Markus Klein commented on patch set 6 V +1 02/17/14, 12:57
Tested with TS: page.20 = TEXT page.20.htmlSpecialChars = 1 page.20.htmlSpecialChars.preserveEntities = 1 page.20.value = De&mo&OO -
Michiel Roos commented on patch set 6 CR -1 02/17/14, 21:50
Core unit tests fail: - bidir_htmlspecialcharsWorksForDecoding with data set "Single encoded entities are not touched" - bidir_htmlspecialcharsWorksForEncoding with data set "Single encoded entities are not touched" -
Markus Klein commented on patch set 6 CR -1 02/17/14, 22:21
The change in HtmlParser from GeneralUtility::htmlspecialchars_decode() to htmlspecialchars_decode() is not a real change since GeneralUtility version just uses the native PHP function. Hence the test case is wrong! -
Stefan Neufeind commented on patch set 6 02/17/14, 22:59
@Markus: Could you push a fix, since you digged deeper into it already? -
Markus Klein commented on patch set 6 02/17/14, 23:11
Sorry I can't, cause I don't know what the test case should represent. You created them, so maybe you know a bit more ;-) -
Stefan Neufeind commented on patch set 6 02/23/14, 12:23
need help, please :-( -
Markus Klein commented on patch set 6 V -1 02/23/14, 21:29
Tests are wrong and the depracation message is fairly misleading. The deHSCentities() call can NOT simply be replaced by a call to htmlspecialchars($str, ENT_COMPAT, 'UTF-8', FALSE). So we don't have a direct replacement for deHSCentities() and hence we shouldn't deprecate it. -
Markus Klein uploaded patch set 7 02/23/14, 21:39
-
Markus Klein voted on patch set 7 CR +1 02/23/14, 21:44
-
Markus Klein commented on patch set 7 V +1 02/23/14, 21:52
Back on track! Votes please.FormEngine.php:1966htmlspecialchars() call missing here! (tested manually) -
Mr. Jenkins commented on patch set 7 02/23/14, 21:52
Build Successful https://ci.typo3.org/job/typo3-v4-core-gerrit/14255/ : SUCCESS -
Stefan Neufeind commented on patch set 7 03/02/14, 07:57
Could somebody take a look please? I won't find the time the next days. -
Tymoteusz Motylewski commented on patch set 7 03/13/14, 10:36
FormEngine.php:1966Replywhere exactly? -
Markus Klein commented on patch set 7 03/13/14, 11:11
FormEngine.php:1966ReplyIt was missing here and is added now in the patch. -
Alexander Opitz voted on patch set 7 V +1 CR +1 03/13/14, 13:27
-
Pascal Dürsteler voted on patch set 7 CR +1 03/13/14, 14:01
-
Stefan Froemken voted on patch set 7 CR +1 03/13/14, 18:29
-
Anja Leichsenring voted on patch set 7 V +2 CR +2 03/13/14, 21:14
-
Anja Leichsenring merged patch set 8 03/13/14, 21:14