[TYPO3-core] RFC: Bug 4689: Error while entering a numbers like 50 or 50.00 into a double2 field

Michael Stucki michael at typo3.org
Thu Feb 15 20:34:33 CET 2007


FYI: I had to revert this change because it seems to cause new problems 
(see links below).

http://bugs.typo3.org/view.php?id=4987
http://bugs.typo3.org/view.php?id=4689

Reverted in TYPO3_4-0 and Trunk.

- michael

Michael Stucki wrote:
> This is a SVN patch request.
> 
> Problem:
> Input fields with type "double2" should be converted into a floating field 
> with 2 decimal points. However, the value in the database (e.g. 50.00) will 
> be converted into "50" upon save. Consequently, the comparison of TCEmain 
> will fail, and an error is returned.
> 
> Solution:
> Wrap the value with floatval() so that 50.00 returns 50, but 50.33 still 
> works.
> 
> Bugtracker reference:
> http://bugs.typo3.org/view.php?id=4689
> 
> Branches:
> TYPO3_4-0 & Trunk
> 
> Comments:
> Thanks to Simon Lang who wrote this fix.
> 
> - michael
> 
> 
> ------------------------------------------------------------------------
> 
> Index: t3lib/class.t3lib_tcemain.php
> ===================================================================
> --- t3lib/class.t3lib_tcemain.php	(Revision 1926)
> +++ t3lib/class.t3lib_tcemain.php	(Arbeitskopie)
> @@ -1928,7 +1928,7 @@
>  						}
>  					}
>  					$theDec = ereg_replace('[^0-9]','',$theDec).'00';
> -					$value = intval(str_replace(' ','',$value)).'.'.substr($theDec,0,2);
> +					$value = floatval(intval(str_replace(' ','',$value)).'.'.substr($theDec,0,2));
>  				break;
>  				case 'md5':
>  					if (strlen($value)!=32){$set=false;}


-- 
Use a newsreader! Check out
http://typo3.org/community/mailing-lists/use-a-news-reader/


More information about the TYPO3-team-core mailing list