[TYPO3-project-formidable] Bug in validation using a userObj

Oliver Klee typo3-german-02 at oliverklee.de
Fri Jun 15 00:36:35 CEST 2007


Hi,

I think I've just stumbled upon a bug in the standard validator using a
userobj (in FORMidable 0.7.0).

My test code looks like this:

<validators>
	<validator:STANDARD>
		<userobj>
			<extension>this</extension>
			<method>isFieldFilledInOrNotRequired</method>
			<params>
				<param name="elementname" value="company" />
			</params>
		
<message>LLL:EXT:onetimeaccount/pi1/locallang.xml:message_company</message>
		</userobj>
	</validator:STANDARD>
</validators>

...

function isFieldFilledInOrNotRequired($foo) {
	t3lib_div::debug($foo, 'foo');
	return false;
}

So I'd expect the following output when "hello" is entered into the
corresponding field:

foo
elementname | company


Instead, I see the following:

foo
|cello|

So that is the input, but the first letter is replaced by the first
letter of the parameter value.


I think the problem is the following:

1. tx_ameosformidable::_callUserObj expects the parameters as the second
function parameter:

function _callUserObj($aUserobj, $aParams = array(), $aItems = FALSE,
$oRef = FALSE, $bAddDots = TRUE) {

2. ... but formidable_mainvalidator::_doTheMagic provides the parameters
as the first function parameter, providing the entered value instead of
the expected parameters:

if(($mUserObj = $this->oForm->_navconf("/userobj", $aConf)) !== FALSE) {
				if(($bExecute = $this->oForm->_callUserObj($aConf, $value)) !== TRUE) {


So I suppose this function call in the validator class needs to be fixed.

Regards,


Oliver


More information about the TYPO3-project-formidable mailing list