Skip to content

Commit

Permalink
Merge pull request #222 from remicollet/issue-php81
Browse files Browse the repository at this point in the history
Fix for PHP 8.1
  • Loading branch information
bluca authored Nov 3, 2021
2 parents 43464c4 + 9af012e commit ee5fbc6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
6 changes: 3 additions & 3 deletions tests/053-z85.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,12 @@ for ($i = 4; $i <= 256; $i += 4) {

// Incorrect length
test_z85_encode('1234567', null);
test_z85_encode(null, null);
test_z85_encode('', null);

test_z85_decode('1234567', null);
test_z85_decode(null, null);
test_z85_decode('', null);

echo "OK";

--EXPECT--
OK
OK
7 changes: 6 additions & 1 deletion zmq_pollset.c
Original file line number Diff line number Diff line change
Expand Up @@ -169,10 +169,15 @@ static
zend_string *s_create_key(zval *entry)
{
if (Z_TYPE_P(entry) == IS_RESOURCE) {
return strpprintf(0, "r:%d", Z_RES_P(entry)->handle);
/* zend_long since 8.1.0 */
return strpprintf(0, "r:%ld", (long)Z_RES_P(entry)->handle);
}
else {
#if PHP_VERSION_ID >= 80100
zend_string *hash = php_spl_object_hash(Z_OBJ_P(entry));
#else
zend_string *hash = php_spl_object_hash(entry);
#endif
zend_string *key = strpprintf(0, "o:%s", hash->val);
zend_string_release(hash);
return key;
Expand Down

0 comments on commit ee5fbc6

Please sign in to comment.