[TYPO3-core] Considerations about deprecationLog

Markus Klein klein.t3 at mfc-linz.at
Sat Jul 16 20:04:25 CEST 2011


Hi everybody,

Today I stumbled over a couple of things concerning the deprecation log feature. After finding some strange entries in my deprecation log file, I dug deeper into the code and found some interesting things.

First I want to describe how I discovered these things:
I found these lines in deprecation_*.log:
-----------------
16.07.2011 16:44: t3lib_div::int_from_ver() - since TYPO3 4.6, will be removed in TYPO3 4.8 - Use t3lib_utility_Math::convertVersionNumberToInteger() instead - require_once#28 // require#201 // require#949 // t3lib_div::int_from_ver#1168 // t3lib_div::logDeprecatedFunction#763 (rc_git/t3lib/class.t3lib_div.php#762)
16.07.2011 16:44: t3lib_div::int_from_ver() - since TYPO3 4.6, will be removed in TYPO3 4.8 - Use t3lib_utility_Math::convertVersionNumberToInteger() instead - require#55 // require#201 // require#949 // t3lib_div::int_from_ver#1168 // t3lib_div::logDeprecatedFunction#763 (rc_git/t3lib/class.t3lib_div.php#762)
16.07.2011 16:44: t3lib_div::int_from_ver() - since TYPO3 4.6, will be removed in TYPO3 4.8 - Use t3lib_utility_Math::convertVersionNumberToInteger() instead - require#55 // require#201 // require#949 // t3lib_div::int_from_ver#1168 // t3lib_div::logDeprecatedFunction#763 (rc_git/t3lib/class.t3lib_div.php#762)
16.07.2011 16:44: t3lib_div::int_from_ver() - since TYPO3 4.6, will be removed in TYPO3 4.8 - Use t3lib_utility_Math::convertVersionNumberToInteger() instead - require#41 // require#201 // require#949 // t3lib_div::int_from_ver#1168 // t3lib_div::logDeprecatedFunction#763 (rc_git/t3lib/class.t3lib_div.php#762)
...
-----------------

Looking at these lines, didn't really give me the enlightenment as a string like "require#55" does say nothing at all.
I traced this down to t3lib_utility_debug:: debugTrail()#228 and changed the line there to include the filenames:
	$path[] = $dat['class'] . $dat['type'] . $dat['function'] . '@' . substr($dat['file'], strlen('/var/www/html/'))  . '#' . $dat['line'];

The resulting deprecation_*.log:
-----------------
16.07.2011 16:53: t3lib_div::int_from_ver() - since TYPO3 4.6, will be removed in TYPO3 4.8 - Use t3lib_utility_Math::convertVersionNumberToInteger() instead - require_once at typo3_src_git/typo3/backend.php#28 // require at typo3_src_git/typo3/init.php#201 // require at typo3_src_git/t3lib/config_default.php#949 // t3lib_div::int_from_ver at t3test/typo3conf/temp_CACHED_ps62e3_ext_localconf.php#1168 // t3lib_div::logDeprecatedFunction at typo3_src_git/t3lib/class.t3lib_div.php#763 (rc_git/t3lib/class.t3lib_div.php#762)
16.07.2011 16:53: t3lib_div::int_from_ver() - since TYPO3 4.6, will be removed in TYPO3 4.8 - Use t3lib_utility_Math::convertVersionNumberToInteger() instead - require at typo3_src_git/typo3/ajax.php#55 // require at typo3_src_git/typo3/init.php#201 // require at typo3_src_git/t3lib/config_default.php#949 // t3lib_div::int_from_ver at t3test/typo3conf/temp_CACHED_ps62e3_ext_localconf.php#1168 // t3lib_div::logDeprecatedFunction at typo3_src_git/t3lib/class.t3lib_div.php#763 (rc_git/t3lib/class.t3lib_div.php#762)
16.07.2011 16:53: t3lib_div::int_from_ver() - since TYPO3 4.6, will be removed in TYPO3 4.8 - Use t3lib_utility_Math::convertVersionNumberToInteger() instead - require at typo3_src_git/typo3/ajax.php#55 // require at typo3_src_git/typo3/init.php#201 // require at typo3_src_git/t3lib/config_default.php#949 // t3lib_div::int_from_ver at t3test/typo3conf/temp_CACHED_ps62e3_ext_localconf.php#1168 // t3lib_div::logDeprecatedFunction at typo3_src_git/t3lib/class.t3lib_div.php#763 (rc_git/t3lib/class.t3lib_div.php#762)
...
-----------------

=====================

It turns out that extdeveval still uses int_from_ver() in its ext_localconf.php.
Finding this would be impossible with the current version of deprecation log in Core.

So the following things need to be changed:
1. logDeprecatedFunction()#5426 uses substr($function->getFileName(), strlen(PATH_site)) to shorten the filepath, but this does not work as you can see from my logs above.
Reason:
/var/www/html/typo3_src_git/  - Source path
/var/www/html/t3test/ - Site path
Doing the substr-thing results in rc_git/.....
2. logDeprecatedFunction()#5416-5421 contains unused code, which can be deleted.
3. t3lib_utility_debug:: debugTrail()#228 additionally has to reflect the file where the function is called from, in order to properly detect the "root of all evil".
4. Update extdeveval to be compliant with 4.6 

Does anybody have a good idea for point 2 how to properly remove the path to TYPO3 source if the deprecated function call is not inside the site itself.
If this is solved, I'll push a patch taking care of points 2 and 3.

Thanks for reading this long mail and your good ideas.

Kind regards
Markus




More information about the TYPO3-team-core mailing list