-
Notifications
You must be signed in to change notification settings - Fork 208
PHPC-2117: Test on PHP 8.2 #1340
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,6 +26,7 @@ jobs: | |
- "7.4" | ||
- "8.0" | ||
- "8.1" | ||
- "8.2" | ||
mongodb-version: | ||
- "4.4" | ||
topology: | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,8 @@ | ||
--TEST-- | ||
MongoDB\BSON\Binary can be cloned | ||
MongoDB\BSON\Binary can be cloned (PHP < 8.2) | ||
--SKIPIF-- | ||
<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?> | ||
<?php skip_if_php_version('>=', '8.2'); ?> | ||
--FILE-- | ||
<?php | ||
|
||
|
@@ -18,7 +21,6 @@ $types = array( | |
foreach($types as $type) { | ||
// Use 16-byte data to satisfy UUID requirements | ||
$binary = new MongoDB\BSON\Binary('randomBinaryData', $type); | ||
$binary->foo = 'bar'; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That's a good point - I'll duplicate the tests and have them create dynamic properties on PHP before 8.2. 👍 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Duplicated each test for PHP 8.2 and restored the originals 👍 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If this test is now restricted to PHP < 8.2, shouldn't we add back the dynamic property testing? This might have been an oversight. Also, quoting
So I think we do want to use |
||
|
||
$clone = clone $binary; | ||
|
||
|
@@ -28,7 +30,6 @@ foreach($types as $type) { | |
unset($binary); | ||
|
||
var_dump($clone); | ||
var_dump($clone->foo); | ||
} | ||
?> | ||
===DONE=== | ||
|
@@ -42,7 +43,6 @@ object(MongoDB\BSON\Binary)#%d (2) { | |
["type"]=> | ||
int(0) | ||
} | ||
string(3) "bar" | ||
bool(true) | ||
bool(false) | ||
object(MongoDB\BSON\Binary)#%d (2) { | ||
|
@@ -51,7 +51,6 @@ object(MongoDB\BSON\Binary)#%d (2) { | |
["type"]=> | ||
int(1) | ||
} | ||
string(3) "bar" | ||
bool(true) | ||
bool(false) | ||
object(MongoDB\BSON\Binary)#%d (2) { | ||
|
@@ -60,7 +59,6 @@ object(MongoDB\BSON\Binary)#%d (2) { | |
["type"]=> | ||
int(2) | ||
} | ||
string(3) "bar" | ||
bool(true) | ||
bool(false) | ||
object(MongoDB\BSON\Binary)#%d (2) { | ||
|
@@ -69,7 +67,6 @@ object(MongoDB\BSON\Binary)#%d (2) { | |
["type"]=> | ||
int(3) | ||
} | ||
string(3) "bar" | ||
bool(true) | ||
bool(false) | ||
object(MongoDB\BSON\Binary)#%d (2) { | ||
|
@@ -78,7 +75,6 @@ object(MongoDB\BSON\Binary)#%d (2) { | |
["type"]=> | ||
int(4) | ||
} | ||
string(3) "bar" | ||
bool(true) | ||
bool(false) | ||
object(MongoDB\BSON\Binary)#%d (2) { | ||
|
@@ -87,7 +83,6 @@ object(MongoDB\BSON\Binary)#%d (2) { | |
["type"]=> | ||
int(5) | ||
} | ||
string(3) "bar" | ||
bool(true) | ||
bool(false) | ||
object(MongoDB\BSON\Binary)#%d (2) { | ||
|
@@ -96,7 +91,6 @@ object(MongoDB\BSON\Binary)#%d (2) { | |
["type"]=> | ||
int(128) | ||
} | ||
string(3) "bar" | ||
bool(true) | ||
bool(false) | ||
object(MongoDB\BSON\Binary)#%d (2) { | ||
|
@@ -105,5 +99,4 @@ object(MongoDB\BSON\Binary)#%d (2) { | |
["type"]=> | ||
int(133) | ||
} | ||
string(3) "bar" | ||
===DONE=== |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
--TEST-- | ||
MongoDB\BSON\Binary can be cloned (PHP >= 8.2) | ||
--SKIPIF-- | ||
<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?> | ||
<?php skip_if_php_version('<', '8.2'); ?> | ||
--FILE-- | ||
<?php | ||
|
||
require_once __DIR__ . '/../utils/basic.inc'; | ||
|
||
$types = array( | ||
MongoDB\BSON\Binary::TYPE_GENERIC, | ||
MongoDB\BSON\Binary::TYPE_FUNCTION, | ||
MongoDB\BSON\Binary::TYPE_OLD_BINARY, | ||
MongoDB\BSON\Binary::TYPE_OLD_UUID, | ||
MongoDB\BSON\Binary::TYPE_UUID, | ||
MongoDB\BSON\Binary::TYPE_MD5, | ||
MongoDB\BSON\Binary::TYPE_USER_DEFINED, | ||
MongoDB\BSON\Binary::TYPE_USER_DEFINED+5, | ||
); | ||
foreach($types as $type) { | ||
// Use 16-byte data to satisfy UUID requirements | ||
$binary = new MongoDB\BSON\Binary('randomBinaryData', $type); | ||
|
||
$clone = clone $binary; | ||
|
||
var_dump($clone == $binary); | ||
var_dump($clone === $binary); | ||
|
||
unset($binary); | ||
|
||
var_dump($clone); | ||
} | ||
?> | ||
===DONE=== | ||
<?php exit(0); ?> | ||
--EXPECTF-- | ||
bool(true) | ||
bool(false) | ||
object(MongoDB\BSON\Binary)#%d (2) { | ||
["data"]=> | ||
string(16) "randomBinaryData" | ||
["type"]=> | ||
int(0) | ||
} | ||
bool(true) | ||
bool(false) | ||
object(MongoDB\BSON\Binary)#%d (2) { | ||
["data"]=> | ||
string(16) "randomBinaryData" | ||
["type"]=> | ||
int(1) | ||
} | ||
bool(true) | ||
bool(false) | ||
object(MongoDB\BSON\Binary)#%d (2) { | ||
["data"]=> | ||
string(16) "randomBinaryData" | ||
["type"]=> | ||
int(2) | ||
} | ||
bool(true) | ||
bool(false) | ||
object(MongoDB\BSON\Binary)#%d (2) { | ||
["data"]=> | ||
string(16) "randomBinaryData" | ||
["type"]=> | ||
int(3) | ||
} | ||
bool(true) | ||
bool(false) | ||
object(MongoDB\BSON\Binary)#%d (2) { | ||
["data"]=> | ||
string(16) "randomBinaryData" | ||
["type"]=> | ||
int(4) | ||
} | ||
bool(true) | ||
bool(false) | ||
object(MongoDB\BSON\Binary)#%d (2) { | ||
["data"]=> | ||
string(16) "randomBinaryData" | ||
["type"]=> | ||
int(5) | ||
} | ||
bool(true) | ||
bool(false) | ||
object(MongoDB\BSON\Binary)#%d (2) { | ||
["data"]=> | ||
string(16) "randomBinaryData" | ||
["type"]=> | ||
int(128) | ||
} | ||
bool(true) | ||
bool(false) | ||
object(MongoDB\BSON\Binary)#%d (2) { | ||
["data"]=> | ||
string(16) "randomBinaryData" | ||
["type"]=> | ||
int(133) | ||
} | ||
===DONE=== |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
--TEST-- | ||
MongoDB\BSON\DBPointer can be cloned (PHP >= 8.2) | ||
--SKIPIF-- | ||
<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?> | ||
<?php skip_if_php_version('<', '8.2'); ?> | ||
--FILE-- | ||
<?php | ||
|
||
require_once __DIR__ . '/../utils/basic.inc'; | ||
|
||
$test = MongoDB\BSON\toPHP(MongoDB\BSON\fromJSON('{ "dbref": {"$dbPointer": {"$ref": "phongo.test", "$id" : { "$oid" : "5a2e78accd485d55b405ac12" } }} }')); | ||
|
||
$dbPointer = $test->dbref; | ||
$clone = clone($dbPointer); | ||
|
||
var_dump($clone == $dbPointer); | ||
var_dump($clone === $dbPointer); | ||
|
||
unset($dbPointer); | ||
|
||
var_dump($clone); | ||
?> | ||
===DONE=== | ||
<?php exit(0); ?> | ||
--EXPECTF-- | ||
bool(true) | ||
bool(false) | ||
object(MongoDB\BSON\DBPointer)#%d (2) { | ||
["ref"]=> | ||
string(11) "phongo.test" | ||
["id"]=> | ||
string(24) "5a2e78accd485d55b405ac12" | ||
} | ||
===DONE=== |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
--TEST-- | ||
MongoDB\BSON\Decimal128 can be cloned (PHP >= 8.2) | ||
--SKIPIF-- | ||
<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?> | ||
<?php skip_if_php_version('<', '8.2'); ?> | ||
<?php if (!class_exists('MongoDB\BSON\Decimal128')) { die('skip MongoDB\BSON\Decimal128 is not available'); } ?> | ||
--FILE-- | ||
<?php | ||
|
||
$decimal = new MongoDB\BSON\Decimal128('1234.5678'); | ||
|
||
$clone = clone $decimal; | ||
|
||
var_dump($clone == $decimal); | ||
var_dump($clone === $decimal); | ||
|
||
unset($decimal); | ||
|
||
var_dump($clone); | ||
?> | ||
===DONE=== | ||
<?php exit(0); ?> | ||
--EXPECTF-- | ||
bool(true) | ||
bool(false) | ||
object(MongoDB\BSON\Decimal128)#%d (1) { | ||
["dec"]=> | ||
string(9) "1234.5678" | ||
} | ||
===DONE=== |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Related: PHP 8.2 warns on dynamic property creation