Skip to content
This repository has been archived by the owner on Dec 11, 2020. It is now read-only.

fix 32bits issue #953

Merged
merged 2 commits into from
Jul 1, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/Faker/Provider/DateTime.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,9 @@ public static function dateTime($max = 'now', $timezone = null)
*/
public static function dateTimeAD($max = 'now', $timezone = null)
{
$min = (PHP_INT_SIZE>4 ? -62135597361 : -PHP_INT_MAX);
return static::setTimezone(
new \DateTime('@' . mt_rand(-62135597361, static::getMaxTimestamp($max))),
new \DateTime('@' . mt_rand($min, static::getMaxTimestamp($max))),
(null === $timezone ? date_default_timezone_get() : $timezone)
);
}
Expand Down
4 changes: 2 additions & 2 deletions src/Faker/Provider/Internet.php
Original file line number Diff line number Diff line change
Expand Up @@ -185,10 +185,10 @@ public static function localIpv4()
{
if (static::numberBetween(0, 1) === 0) {
// 10.x.x.x range
$ip = long2ip(static::numberBetween(167772160, 184549375));
$ip = long2ip(static::numberBetween(ip2long("10.0.0.0"), ip2long("10.255.255.255")));
} else {
// 192.168.x.x range
$ip = long2ip(static::numberBetween(3232235520, 3232301055));
$ip = long2ip(static::numberBetween(ip2long("192.168.0.0"), ip2long("192.168.255.255")));
}

return $ip;
Expand Down