View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0007074 | OXID eShop (all versions) | 4.05. Performance | public | 2020-01-20 18:30 | 2023-11-23 19:07 |
Reporter | timwetter | Assigned To | |||
Priority | normal | Severity | minor | Reproducibility | always |
Status | closed | Resolution | fixed | ||
Product Version | 6.2.0-rc.1 | ||||
Fixed in Version | 7.0.0 | ||||
Summary | 0007074: workaround for #36008 bug in php in file Utils.php wihtout phpversion check | ||||
Description | the workaround for php bug #36008 is obsolet for phpversion >= 5.3. it may be better for performance to check if someone still uses php < 5.3 and then do the workaround!? /** * Rounds the value to currency cents. This method does NOT format the number. * * @param string $sVal the value that should be rounded * @param object $oCur Currency Object * * @return float */ public function fRound($sVal, $oCur = null) { startProfile('fround'); //cached currency precision, this saves about 1% of execution time $iCurPrecision = $this->_iCurPrecision; if (is_null($iCurPrecision)) { if (!$oCur) { $oCur = $this->getConfig()->getActShopCurrencyObject(); } $iCurPrecision = $oCur->decimal; $this->_iCurPrecision = $iCurPrecision; } // if < 5.3.x this is a workaround for #36008 bug in php - incorrect round() & number_format() result (R) ++ $sVal = (float) $sVal; ++ if (phpversion() < '5.3') { static $dprez = null; if (!$dprez) { $prez = @ini_get("precision"); if (!$prez || $prez > 12) { $prez = 12; } $dprez = pow(10, -$prez); } ++ stopProfile('fround'); ++ return round($sVal + $dprez * ($sVal >= 0 ? 1 : -1), $iCurPrecision); ++ } stopProfile('fround'); -- $sVal = (float) $sVal; return round($sVal, $iCurPrecision); } | ||||
Tags | No tags attached. | ||||
Theme | Not defined | ||||
Browser | Not defined | ||||
PHP Version | Not defined | ||||
Database Version | Not defined | ||||
|
Hey Tim, looks reasonable to me, would you mind opening a pull request on our GitHub Repository? https://github.com/OXID-eSales/oxideshop_ce/blob/b-6.x/source/Core/Utils.php Kind regards Florian |
|
-MK |
|
Fixed wrong status. -MK |
|
Fixed in commit https://github.com/OXID-eSales/oxideshop_ce/commit/ded9c3be6703c756790dda110a46abcd3e372cd7 for OXID 7 |