Skip to content
This repository has been archived by the owner on Apr 1, 2024. It is now read-only.

Commit

Permalink
Support HHVM's PHP7 mode
Browse files Browse the repository at this point in the history
Was calling md5(int), which is invalid.
  • Loading branch information
fredemmott committed Jun 26, 2017
1 parent 25c62c8 commit d9171c8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions .travis.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,6 @@ curl https://getcomposer.org/installer | hhvm -d hhvm.jit=0 --php -- /dev/stdin
cd /var/source
hhvm -d hhvm.jit=0 /usr/local/bin/composer install
hhvm -d hhvm.jit=0 vendor/bin/phpunit tests/
if [ $(hhvm --php -r 'echo HHVM_VERSION_ID;' 2>/dev/null) -ge 32002 ]; then
hhvm -d hhvm.php7.all=1 -d hhvm.jit=0 vendor/bin/phpunit tests/
fi
2 changes: 1 addition & 1 deletion src/html/XHPBaseHTMLHelpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public function requireUniqueID(): string {
$id = /* UNSAFE_EXPR */ $this->:id;
if ($id === null || $id === '') {
try {
$this->setAttribute('id', $id = substr(md5(mt_rand(0, 100000)), 0, 10));
$this->setAttribute('id', $id = bin2hex(random_bytes(5)));
} catch (XHPInvalidAttributeException $error) {
throw new XHPException(
'You are trying to add an HTML id to a(n) '.
Expand Down

0 comments on commit d9171c8

Please sign in to comment.