[TYPO3-core] RFC: Bugfix #7425: syntax error in temp_CACHE*.php

Ernesto Baschny [cron IT] ernst at cron-it.de
Mon Feb 18 11:50:46 CET 2008


Steffen Kamper wrote: on 18.02.2008 10:01:
> "Ernesto Baschny [cron IT]" <ernst at cron-it.de> schrieb im Newsbeitrag 
> news:mailman.1.1203324869.22247.typo3-team-core at lists.netfielders.de...
>> Steffen Kamper wrote: on 06.02.2008 21:20:
>>
>>> Branches: Trunk only
>>>
>>> BT reference: http://bugs.typo3.org/view.php?id=7425
>>>
>>> Type: Bugfix
>>>
>>> Problem:
>>>
>>> if extensions ext_localconf.php or ext_tables.php misses php endtag, 
>>> there
>>> is a syntax error in temp_CACHE*.php because they are merged together, 
>>> and
>>> then such a construct leads to the syntax error:
>>>
>>> <?php
>>> ....
>>> <?php
>>>
>>> Solution:
>>>
>>> strip out php-tags and wrap with single php-tag
>> +1 to the idea, but the preg expression is wrong. As ries already
>> pointed out, any "?>" or "<?php" in the ext*.php will be stripped out,
>> which might not be desired. Only leading and ending tags should be
>> stripped. And as we also add some "<?php" and "?>" in extMgm itself,
>> those have to be stripped too (or better not even added).
>>
>> Attached patch does that.
>>
>> Cheers,
>> Ernesto
>>
> 
> Hi Ernesto,
> 
> ries was wrong because this are no content files - it's only ext_tables and 
> localconf, so there can't be a text with <?php or ?>.
> Sure the added were stripped too but i wrapped the whole.
> 
> I did tests and all were correct.

How do you know that there aren't <?php and ?> in the 
ext_tables/localconf files in extensions? It might be used somewhere. 
Either in some text string (e.g. for writing some PHP file) or even to 
generate some output. This:

	$string = '<?php echo Hi; ?>';

will become this:

	$string = 'echo Hi;';

with your patch. And this:

	ob_start();
	?>
		This is my output
	<?php
	$string = ob_get_contents();

will become:

	ob_start();
		This is my output
	$string = ob_get_contents();

which is why I consider it too much to strip.

Cheers,
Ernesto


More information about the TYPO3-team-core mailing list