[BUGFIX] isValidUrl() idna converts whole URI
GeneralUtility::isValidUrl() idna converts whole URI instead of domain only. The expensive idna_convert() is called from isValidUrl(). Instead of feeding it just the domain part, the whole URI is converted. When supplying just the domain part, a great speed gain can be seen. On seriously malformed URLs, parse_url() may return FALSE and emits an E_WARNING. So we check for that first. PHP no longer supports the flags FILTER_FLAG_HOST_REQUIRED and FILTER_FLAG_SCHEME_REQUIRED. A scheme is now required by default. [1] Return FALSE if the URL does not start with a scheme. A public GeneralUtility::idnaEncode() method uses a static idna_convert instance and fetches converted strings from a string cache array to avoid multiple checks on the same domain. All manual idna_convert instances are replaced with GeneralUtility::idnaEncode() calls. Special characters are not allowed in the URL except in the domain part [2]. So the test with special characters in the path was removed from the GeneralUtilityTest class. [1] http://www.php.net/manual/en/filter.filters.flags.php#107382 [2] http://tools.ietf.org/html/rfc3986#appendix-A Change-Id: I7a0ab0a399d9d6cf68c824f413be6b6d621947c1 Resolves: #53862 Releases: 6.2, 6.1, 6.0 Reviewed-on: https://review.typo3.org/25636 Reviewed-by: Markus Klein Reviewed-by: Wouter Wolters Tested-by: Wouter Wolters Reviewed-by: Michiel Roos Tested-by: Michiel Roos Tested-by: Markus Klein Reviewed-by: Andreas Wolf Reviewed-by: Jo Hasenau Reviewed-by: Xavier Perseguers Tested-by: Xavier Perseguers
Showing
- typo3/sysext/core/Classes/DataHandling/DataHandler.php 2 additions, 6 deletionstypo3/sysext/core/Classes/DataHandling/DataHandler.php
- typo3/sysext/core/Classes/Utility/GeneralUtility.php 94 additions, 6 deletionstypo3/sysext/core/Classes/Utility/GeneralUtility.php
- typo3/sysext/core/Tests/Unit/Utility/GeneralUtilityTest.php 7 additions, 7 deletionstypo3/sysext/core/Tests/Unit/Utility/GeneralUtilityTest.php
- typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php 2 additions, 5 deletions.../frontend/Classes/ContentObject/ContentObjectRenderer.php
Please register or sign in to comment