I saw this thread on a forum, which makes me relate the issue mentioned in the thread to integer ranges.
Basically, the thread is about storing a big integer and getting output as a negative number.
However I can't find any information about integer ranges from libyaml nor the PHP YAML extension. When calling yaml_emit() with a very large number, would it be casted/truncated?
For example, if you call yaml_emit() with a very large integer, but that integer is within the range allowed by the current PHP binaries, would the result be different?
These are the tests I have made locally:
This means that
yaml_emit()would treat all content integers as 32-bit integers. If they are out of range, they would be truncated.Similarly, this is true even on 64-bit PHP binaries:
Furthermore, according to the PECL YAML source, it appears that PHP ints are handled as
longs, which somehow ended up as 32-bit signed integers even on 64-bit systems and binaries.