[TYPO3-core] RFC #8566: Unable to match TS condition when variable is not set

Oliver Hader oliver at typo3.org
Sun Jun 1 15:16:42 CEST 2008


Hi Dmitry,

Dmitry Dulepov [typo3] schrieb:
> Hi!
> 
> This is SVN patch request.
> 
> Type: bug
> 
> Branches: 4.1, 4.2, trunk
> 
> Problem: The following perfectly valid condition does not match if 
> "param" is not found in URL or if it is set to empty value in the URL:
> 
> [globalVar = GP:param = /^$/]
> 
> The problem is that t3lib_matchcondition::matchWild() requires non-empty 
> string to test. No idea why but it does not make sense to have this 
> restriction.
> 
> Solution: remove check for non-empty value in the 
> t3lib_matchcondition::matchWild().

Bugtracker Reference:
http://bugs.typo3.org/view.php?id=8566

> Note: I also reformatted the function according to coding conventions. 
> The change is obvious, I hope no separate patch is needed.
> 
> How to test:
> 1. URL: http://whatever/?param=
> 2. TS:
> ===================
> page.10 = TEXT
> page.10.value = Not working or no "param" in URL
> [globalString = GP:param = /^$/]
> page.10.value = Working properly!
> [global]
> ===================

I attached a new patch which two changes:
* If the condition is e.g. "/^/$/" it will fail because of the unescaped 
PREG delimiter in the middle of the pattern - this is just an additional 
bugfix.
* The return type of the method is boolean, but preg_match returns false 
or the count of matches (actually 0 or 1, because preg_match will stop 
after the first match). But the result has to be casted to (bool).

+1 on reading and testing - if you take my small corrections ;)

olly
-- 
Oliver Hader
TYPO3 4.3 Release Manager
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0008566_v2.patch
Type: text/x-patch
Size: 1657 bytes
Desc: not available
Url : http://lists.netfielders.de/pipermail/typo3-team-core/attachments/20080601/25a23c12/attachment.bin 


More information about the TYPO3-team-core mailing list