[TYPO3-core] RFC: fix IRRE in workspaces

Martin Kutschker martin.kutschker-n0spam at no5pam-blackbox.net
Tue May 1 17:07:36 CEST 2007


Michael Stucki schrieb:
> 
> @@ -517,7 +517,9 @@
>                         // if there are table items and we have a proper $parentUid
>                 if (t3lib_div::testInt($parentUid) && count($this->tableArray)) {
>                                 // if updateToUid is not a positive integer, set it to '0', so it will be ignored
> -                       if (!(t3lib_div::testInt($updateToUid) && $updateToUid > 0)) $updateToUid = 0;
> +                       if (!t3lib_div::testInt($updateToUid) && $updateToUid > 0) {
> +                               $updateToUid = 0;
> +                       }
>                         $fields = 'uid,'.$foreign_field.($symmetric_field ? ','.$symmetric_field : '');
> 
>                                 // update all items
> 
> => $updateToUid is never >0 when it is not an integer value!

The original code had the ! around the whole expression:
!(a && b).

After the change it's (!a && b), which is not the same.

I guess this was just a slip. But isn't it better to do argument checks 
(aka asserts) right at the beginning of a function? I guess it doesn't 
make much sense if $parentUid and $updateToUid are not integers.

Masi


More information about the TYPO3-team-core mailing list