News for hackers. Stuff that matters.
Re:My Reality Moment. Why did I ever agree to do this? by danans on Friday September 18, 2015 @07:34PM (#10242656)
12 years ago, I was working on a PHP library to parse XMLRPC requests, and I ran into it's numeric type slipperiness in a painful way. I was (naively) using PHP's eval to parse a decimal numeric string.

I noticed what seemed like random numeric errors in a random subset of RPCs. It turned out, after what seemed like eons of investigation, that some clients were stringifying decimal integers with leading zeros, which made PHP interpret them as octal numbers, and hence the random seeming errors.

Having come from a strongly-typed-language background (C/C++/Java), that was a major learning experience about the caveats of weakly typed languages.

Re:My Reality Moment. Why did I ever agree to do this? by herge on Friday September 18, 2015 @08:41PM (#10242842)
What does typing have anything to do with this 'feature' in the number parser? If atoi in C also parsed octal numbers, you would have had the same problem.

Your issue is with the too liberal number parser.

Re:My Reality Moment. Why did I ever agree to do this? by danans on Saturday September 19, 2015 @03:08AM (#10243568)
It was a tangentially related personal anecdote from 12 years ago. You are welcome to ignore it if you find it irksome.