Skip to content

Commit

Permalink
Fix PHP 7.0 / 7.1
Browse files Browse the repository at this point in the history
  • Loading branch information
thekid committed Oct 21, 2021
1 parent 68b820f commit e69d16f
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
6 changes: 6 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@ JSON for the XP Framework ChangeLog

## ?.?.? / ????-??-??

## 5.0.1 / 2021-10-21

* Fixed PHP 7.0 and 7.1 compatibility: *Call to undefined function
spl_object_id()*, see https://www.php.net/spl_object_id
(@thekid)

## 5.0.0 / 2021-10-21

* Made compatible with PHP 8.1 - add `ReturnTypeWillChange` attributes to
Expand Down
2 changes: 1 addition & 1 deletion src/main/php/text/json/Format.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ public function representationOf($value) {
public function toString() { return nameof($this); }

/** @return string */
public function hashCode() { return spl_object_id($this); }
public function hashCode() { return spl_object_hash($this); }

/**
* Comparison
Expand Down
5 changes: 5 additions & 0 deletions src/test/php/text/json/unittest/FormatTest.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ public function string() {
$this->assertEquals('"Test"', $this->format()->representationOf('Test'));
}

#[Test]
public function hash_code() {
$this->assertNotEquals('', $this->format()->hashCode());
}

#[Test]
public function slash_is_escaped_per_default() {
$this->assertEquals('"xp-framework\/core"', $this->format()->representationOf('xp-framework/core'));
Expand Down

0 comments on commit e69d16f

Please sign in to comment.