[TYPO3-core] return value of t3lib_div::resolveSheetDefInDS()

Dmitry Dulepov dima at spamcop.net
Mon Mar 20 14:52:11 CET 2006


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi!

Martin Kutschker wrote:
> This is the description of the return value:
> 
> "An array with two num. keys: key0: The data structure is returned in this key (array) UNLESS an error happend in which case an error string is returned (string). key1: The used sheet key value!"
> 
> Cannot say I like this very much. Returning FALSE on error is a PHP practice. Returning strings just looks awful.
> 
> We had the discussion before with FALSE and -1. Now it's strings. And all this only because of this stupid PHP5 errors... Ok, i fact it's an error in the calling code.

I usually use:

function foo($bar, &$error) {
	if (errorHappens($bar)) {
		$error = 'Error happened!';
		return false;
	}
	return true;
}

Drawback: cannot use default values if $error is the last parameter.

Dmitry.
- --
"It is our choices, that show what we truly are,
far more than our abilities." (A.P.W.B.D.)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (MingW32)

iD8DBQFEHrOLRVcYnKJ8N6kRAlUNAJwMgLBbN4pA4zKb2MWTQ8B9lAKxvgCeInM8
YzkGmylqyBJ3s/raJZmq2Oc=
=tHhA
-----END PGP SIGNATURE-----



More information about the TYPO3-team-core mailing list