【发布时间】:2015-01-14 17:57:34
【问题描述】:
查看Propel的源代码(PHP ORM库),我在propel/propel1/runtime/lib/query/Criteria.php文件中找到了这个方法:
/**
* Set offset.
*
* @param int $offset An int with the value for offset. (Note this values is
* cast to a 32bit integer and may result in truncation)
*
* @return Criteria Modified Criteria object (for fluent API)
*/
public function setOffset($offset)
{
$this->offset = (int) $offset;
return $this;
}
为什么在文档中他们说转换为 int 的值可能会导致截断???是不是 int 保持在例如4000000000 在 64 位环境中?其实是这样的,为什么是这个“笔记”呢?
感谢关注!
【问题讨论】:
-
毕竟不是所有的 PHP 安装都是 64 位的。在 32 位 PHP 安装中,int 的最大值为 2^31-1。
-
@MarcB 我知道,但是如果您阅读文档,他们似乎假设 64 位也是如此,但事实并非如此。