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

Commit

Permalink
Merge pull request #953 from remicollet/issue-32bits
Browse files Browse the repository at this point in the history
fix 32bits issue
  • Loading branch information
fzaninotto authored Jul 1, 2016
2 parents f23e418 + b5c340b commit 6b7ebbb
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
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

0 comments on commit 6b7ebbb

Please sign in to comment.