Project

General

Profile

Actions

Bug #15121

closed

Always preg_* instead of ereg_* functions

Added by Michael Stucki over 18 years ago. Updated over 17 years ago.

Status:
Closed
Priority:
Must have
Category:
-
Target version:
-
Start date:
2005-10-20
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
3.8-dev
PHP Version:
4
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

preg_* is much faster than ereg_*, therefore it should be used everywhere.

(issue imported from #M1685)


Files

preg_t3lib_parsehtml.diff (18.8 KB) preg_t3lib_parsehtml.diff Administrator Admin, 2005-10-27 00:46
t3lib_parsehtml__pregtestsuite.tar.gz (80.8 KB) t3lib_parsehtml__pregtestsuite.tar.gz Administrator Admin, 2005-10-27 00:47
Actions #1

Updated by Sebastian Kurfuerst over 18 years ago

131 ereg functions in tslib
314 ereg functions in t3lib

Actions #2

Updated by Bernhard Kraft over 18 years ago

Attached as files a fix which replaces all ereg's and split's in t3lib_parsehtml (used by automaketemplate and TV) with preg calls.

The tar.gz is a testsuite so you can test the speedup of the different methods of the class and verify the behave the same. Some of the methods now only need 8-15 % of the previous time.

preg_t3lib_parsehtml.diff : Patch
t3lib_parsehtml__pregtestsuite.tar.gz : Test-Suite

Actions #3

Updated by Ingo Renner over 18 years ago

how about replacing them in the whole core?

Actions #4

Updated by Michael Stucki over 18 years ago

how about replacing them in the whole core?

Step by step...! :-)

Actions #5

Updated by Bernhard Kraft over 18 years ago

I have already done this for t3lib_tsparser.php and t3lb_div.php .... But I still need to write the test-suite for those libraries (of course based on the previous one) ...

I don't think you can use refactored code without proper unit-testing. And as Michael stated this should get done step by step. I think the best method is to convert one class at once as this is an affordable amount of time needed to get invested at one time.

If some seldomly used ereg's are still there in 4.0.0 it won't hurt ... But you are right: The major part of heavyly used eregs/splits should get replaced as soon as possible.

Actions #6

Updated by Michiel Roos over 18 years ago

Good point Michael,

I'll fix my extensions right away.

Michiel

Actions #7

Updated by Scott Carson over 18 years ago

On behalf of the newbies ... I'm convinced this a great patch but, how do I install it????

Thanks!

Actions #8

Updated by Sebastian Kurfuerst over 18 years ago

Hi Scott,
this patch is not for end-users yet. It will most likely be included in the next TYPO3 release. What benefits do you expect from using it?
Greets, Sebastian

Actions #9

Updated by Bernhard Kraft over 18 years ago

Hi Scott,

As Sebastian stated this is not for production use. But if you want to help with testing you can download the t3lib_parsehtml__pregtestsuite.tar.gz to your development server. Extract the tar.gz and change to contained subdir "t3lib_parsehtml__pregtestsuite/testing_parsehtml/"

There you find .php executables: test_ (i.e. test_getSubpart.php) which test the single methods of t3lib_parsehtml.
You can invoke/call them by typing their name preceded by ./ (you need that on most UNIXes):
./test_getSubpart.php
Then a test will run through.

You can change the testdata in the "data_parsehtml.php" file and by changing the three testX.html files.

If you want to test the new parshtml library directly with TYPO3 just copy over the file class.t3lib_parsehtml_new.php to your t3lib/ directory over the original class.t3lib_parsehtml.php file (DON'T FORGET TO BACKUP THE ORIGINAL BEFORE !)

Please tell us your overall experiences.

Actions #10

Updated by Bernhard Kraft over 18 years ago

The suggested patch for t3lib_parsehtml is now in CVS and part of TYPO3 4.0.0 beta1

Actions #11

Updated by Sebastian Kurfuerst over 18 years ago

I hope you don't mind when I close this issue. - Cleanup.
Greets, Sebastian

Actions

Also available in: Atom PDF