Giter VIP home page Giter VIP logo

Comments (9)

m-overlund avatar m-overlund commented on September 26, 2024 1

I do expect postcode to be a number :)
(I do use number to be able to search from/to postcodes)

There was cases of whitespace included in value, customers who had written postcode in city and vice versa, in customer profile address (my fault).
But that isn't my point with this issue.

To my knowledge, the only reason to multiply the value with 1, is to make sure a string is converted to a number?
So i believe that either it should expect a number or convert in a better way, or handle an exception?

from magento-lts.

kiatng avatar kiatng commented on September 26, 2024 1

There are many places that can throw

TypeError: Unsupported operand types: string * int :

that need to be fixed as well.

$value = ($rate['value'] ?? $rate['percent']) * 1;

app\code\core\Mage\Adminhtml\Block](

return $item->getCalculationPrice() * 1;
}
/**
* Returns the item's original editable price
*
* @param Mage_Sales_Model_Quote_Item $item
* @return float
*/
public function getOriginalEditablePrice($item)
{
if ($item->hasOriginalCustomPrice()) {
$result = $item->getOriginalCustomPrice() * 1;
} elseif ($item->hasCustomPrice()) {
$result = $item->getCustomPrice() * 1;
} elseif (Mage::helper('tax')->priceIncludesTax($this->getStore())) {
$result = $item->getPriceInclTax() * 1;
} else {
$result = $item->getOriginalPrice() * 1;

from magento-lts.

kiatng avatar kiatng commented on September 26, 2024

If your postcode is not a number, why do you set 'type' => 'number'?

from magento-lts.

kiatng avatar kiatng commented on September 26, 2024

Can you do a PR?

from magento-lts.

m-overlund avatar m-overlund commented on September 26, 2024

Can you do a PR?

Yeah, I'll have a go at it and submit a PR :)

Ref:
https://github.com/search?q=repo%3AOpenMage%2Fmagento-lts+%22+*+1%3B%22&type=code
https://github.com/search?q=repo%3AOpenMage%2Fmagento-lts+%22+*+1+%22&type=code

from magento-lts.

sreichel avatar sreichel commented on September 26, 2024

Please do not change.

You can add a custom column renderer, observe _before_save or _after_load, validate input ... no need to change core for some wrong input.

from magento-lts.

m-overlund avatar m-overlund commented on September 26, 2024

I don't want to change core due to wrong input - i found the odd number conversion code due to wrong input handling.
If the mentioned core code is not an issue, i'll just close it.

from magento-lts.

kiatng avatar kiatng commented on September 26, 2024

You can try: https://onlinephp.io?s=s7EvyCjg5VIpLilSsFVQN1S35uUqSyyKTynNLdAAi2orGGhaAwA%2C&v=8.2.12

$number = '1' * 1; // int(1)
$number = '1.01' * 1; // float(1.01)
$number = 'str' * 1; // Fatal error: Uncaught TypeError: Unsupported operand types: string * int

Is it wrong to throw the last error? It depends on the use case. For

In the core, the above code is used for column of type int as defined in the DB. So it's probably ok to throw an error, I think. So I changed the label to "bug unconfirmed".

from magento-lts.

m-overlund avatar m-overlund commented on September 26, 2024

Sounds right.
I'll close it up.

from magento-lts.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.