11

I once made an oopsie in an API for a logistics provider (one of the biggest in Germany...).

To understand the oopsie...

Based on input data a string must be created containing several hex / string / formatted values.

Think of ...

$return .= sprintf("%02X", ...)

I think there were around 15 to 20 lines, although more complicated.

The bug happened because I had a brainfart.

What was previously one line with... Many many many many variables, I had to split into multiple lines since internal stuff changed and it was impossible to change this oneliner of hell with >50 formatting codes.

Of course we didn't test everything.
XD

What we didn't test was - funnily enough - wether the casting was correct in all cases.

I misplaced a formatting code.

And we had a major brainfart because we tested integer, but not double / float values....

We sent for a long time packages much cheaper than allowed (took thw logistics provider nearly 3-4 months to realize this :) ).

Spot the difference:

@highlight
print sprintf("%01.2s", $money).PHP_EOL;

print sprintf("%01.2f", $money).PHP_EOL;

Comments
  • 2
    Shhh... You cant @ in Posts.
    But damn, diffrence between s and f.
Add Comment