Skip to content

PHPC-1965 Re-enable PHP 8.1 build on GH Actions #1258

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

Merged
merged 4 commits into from
Sep 7, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@ jobs:
php-version:
- "7.4"
- "8.0"
# Re-enable after PHPC-1849 is resolved
# - "8.1"
- "8.1"
mongodb-version:
- "4.4"
topology:
Expand Down
2 changes: 1 addition & 1 deletion tests/bson/bson-binary_error-002.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ class MyBinary extends MongoDB\BSON\Binary {}
===DONE===
<?php exit(0); ?>
--EXPECTF--
Fatal error: Class MyBinary may not inherit from final class (MongoDB\BSON\Binary) in %s on line %d
Fatal error: Class MyBinary %s final class %SMongoDB\BSON\Binary%S in %s on line %d
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Noted that this pertains to php/php-src#7307.

2 changes: 1 addition & 1 deletion tests/bson/bson-dbpointer_error-002.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ class MyDBPointer extends MongoDB\BSON\DBPointer {}
===DONE===
<?php exit(0); ?>
--EXPECTF--
Fatal error: Class MyDBPointer may not inherit from final class (MongoDB\BSON\DBPointer) in %s on line %d
Fatal error: Class MyDBPointer %s final class %SMongoDB\BSON\DBPointer%S in %s on line %d
2 changes: 1 addition & 1 deletion tests/bson/bson-decimal128_error-002.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ class MyDecimal128 extends MongoDB\BSON\Decimal128 {}
===DONE===
<?php exit(0); ?>
--EXPECTF--
Fatal error: Class MyDecimal128 may not inherit from final class (MongoDB\BSON\Decimal128) in %s on line %d
Fatal error: Class MyDecimal128 %s final class %SMongoDB\BSON\Decimal128%S in %s on line %d
2 changes: 1 addition & 1 deletion tests/bson/bson-int64_error-001.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ class MyInt64 extends MongoDB\BSON\Int64 {}
===DONE===
<?php exit(0); ?>
--EXPECTF--
Fatal error: Class MyInt64 may not inherit from final class (MongoDB\BSON\Int64) in %s on line %d
Fatal error: Class MyInt64 %s final class %SMongoDB\BSON\Int64%S in %s on line %d
2 changes: 1 addition & 1 deletion tests/bson/bson-javascript_error-002.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ class MyJavascript extends MongoDB\BSON\Javascript {}
===DONE===
<?php exit(0); ?>
--EXPECTF--
Fatal error: Class MyJavascript may not inherit from final class (MongoDB\BSON\Javascript) in %s on line %d
Fatal error: Class MyJavascript %s final class %SMongoDB\BSON\Javascript%S in %s on line %d
2 changes: 1 addition & 1 deletion tests/bson/bson-maxkey_error-001.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ class MyMaxKey extends MongoDB\BSON\MaxKey {}
===DONE===
<?php exit(0); ?>
--EXPECTF--
Fatal error: Class MyMaxKey may not inherit from final class (MongoDB\BSON\MaxKey) in %s on line %d
Fatal error: Class MyMaxKey %s final class %SMongoDB\BSON\MaxKey%S in %s on line %d
2 changes: 1 addition & 1 deletion tests/bson/bson-minkey_error-001.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ class MyMinKey extends MongoDB\BSON\MinKey {}
===DONE===
<?php exit(0); ?>
--EXPECTF--
Fatal error: Class MyMinKey may not inherit from final class (MongoDB\BSON\MinKey) in %s on line %d
Fatal error: Class MyMinKey %s final class %SMongoDB\BSON\MinKey%S in %s on line %d
2 changes: 1 addition & 1 deletion tests/bson/bson-objectid_error-002.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ class MyObjectId extends MongoDB\BSON\ObjectId {}
===DONE===
<?php exit(0); ?>
--EXPECTF--
Fatal error: Class MyObjectId may not inherit from final class (MongoDB\BSON\ObjectId) in %s on line %d
Fatal error: Class MyObjectId %s final class %SMongoDB\BSON\ObjectId%S in %s on line %d
2 changes: 1 addition & 1 deletion tests/bson/bson-regex_error-002.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ class MyRegex extends MongoDB\BSON\Regex {}
===DONE===
<?php exit(0); ?>
--EXPECTF--
Fatal error: Class MyRegex may not inherit from final class (MongoDB\BSON\Regex) in %s on line %d
Fatal error: Class MyRegex %s final class %SMongoDB\BSON\Regex%S in %s on line %d
2 changes: 1 addition & 1 deletion tests/bson/bson-symbol_error-001.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ class MySymbol extends MongoDB\BSON\Symbol {}
===DONE===
<?php exit(0); ?>
--EXPECTF--
Fatal error: Class MySymbol may not inherit from final class (MongoDB\BSON\Symbol) in %s on line %d
Fatal error: Class MySymbol %s final class %SMongoDB\BSON\Symbol%S in %s on line %d
2 changes: 1 addition & 1 deletion tests/bson/bson-timestamp_error-002.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ class MyTimestamp extends MongoDB\BSON\Timestamp {}
===DONE===
<?php exit(0); ?>
--EXPECTF--
Fatal error: Class MyTimestamp may not inherit from final class (MongoDB\BSON\Timestamp) in %s on line %d
Fatal error: Class MyTimestamp %s final class %SMongoDB\BSON\Timestamp%S in %s on line %d
2 changes: 1 addition & 1 deletion tests/bson/bson-undefined_error-001.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ class MyUndefined extends MongoDB\BSON\Undefined {}
===DONE===
<?php exit(0); ?>
--EXPECTF--
Fatal error: Class MyUndefined may not inherit from final class (MongoDB\BSON\Undefined) in %s on line %d
Fatal error: Class MyUndefined %s final class %SMongoDB\BSON\Undefined%S in %s on line %d
2 changes: 1 addition & 1 deletion tests/bson/bson-utcdatetime_error-002.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ class MyUTCDateTime extends MongoDB\BSON\UTCDateTime {}
===DONE===
<?php exit(0); ?>
--EXPECTF--
Fatal error: Class MyUTCDateTime may not inherit from final class (MongoDB\BSON\UTCDateTime) in %s on line %d
Fatal error: Class MyUTCDateTime %s final class %SMongoDB\BSON\UTCDateTime%S in %s on line %d
5 changes: 4 additions & 1 deletion tests/bson/bug1839-001.phpt
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
--TEST--
PHPC-1839: Referenced, out-of-scope, non-interned string in typeMap
PHPC-1839: Referenced, out-of-scope, non-interned string in typeMap (PHP < 8.1)
--SKIPIF--
<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
<?php skip_if_php_version('>=', '8.1'); ?>
--FILE--
<?php
require_once __DIR__ . "/../utils/basic.inc";
Expand Down
5 changes: 4 additions & 1 deletion tests/bson/bug1839-002.phpt
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
--TEST--
PHPC-1839: Referenced, local, non-interned string in typeMap
PHPC-1839: Referenced, local, non-interned string in typeMap (PHP < 8.1)
--SKIPIF--
<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
<?php skip_if_php_version('>=', '8.1'); ?>
--FILE--
<?php
require_once __DIR__ . "/../utils/basic.inc";
Expand Down
5 changes: 4 additions & 1 deletion tests/bson/bug1839-003.phpt
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
--TEST--
PHPC-1839: Referenced, out-of-scope, interned string in typeMap
PHPC-1839: Referenced, out-of-scope, interned string in typeMap (PHP < 8.1)
--SKIPIF--
<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
<?php skip_if_php_version('>=', '8.1'); ?>
--FILE--
<?php
require_once __DIR__ . "/../utils/basic.inc";
Expand Down
5 changes: 4 additions & 1 deletion tests/bson/bug1839-004.phpt
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
--TEST--
PHPC-1839: Referenced, local, interned string in typeMap
PHPC-1839: Referenced, local, interned string in typeMap (PHP < 8.1)
--SKIPIF--
<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
<?php skip_if_php_version('>=', '8.1'); ?>
--FILE--
<?php
require_once __DIR__ . "/../utils/basic.inc";
Expand Down
59 changes: 59 additions & 0 deletions tests/bson/bug1839-005.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
--TEST--
PHPC-1839: Referenced, out-of-scope, non-interned string in typeMap (PHP >= 8.1)
--SKIPIF--
<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
<?php skip_if_php_version('<', '8.1'); ?>
--FILE--
<?php
require_once __DIR__ . "/../utils/basic.inc";

function createTypemap()
{
// Assemble the string so as to not have an interned string
$rootValue = chr(ord('a')) . 'rray';
$documentValue = chr(ord('a')) . 'rray';

// Use a reference to this non-interned string in the type map
$typemap = ['root' => &$rootValue, 'document' => &$documentValue];

return $typemap;
}

$typemap = createTypemap();
$bson = MongoDB\BSON\fromPhp((object) []);

echo "Before:\n";
debug_zval_dump($typemap);

MongoDB\BSON\toPHP($bson, $typemap);

echo "After:\n";
debug_zval_dump($typemap);

?>
===DONE===
<?php exit(0); ?>
--EXPECT--
Before:
array(2) refcount(2){
["root"]=>
reference refcount(1) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Noted that this pertains to php/php-src#6750.

This is much more useful output than pre-8.1. Very nice.

string(5) "array" refcount(1)
}
["document"]=>
reference refcount(1) {
string(5) "array" refcount(1)
}
}
After:
array(2) refcount(2){
["root"]=>
reference refcount(1) {
string(5) "array" refcount(1)
}
["document"]=>
reference refcount(1) {
string(5) "array" refcount(1)
}
}
===DONE===
51 changes: 51 additions & 0 deletions tests/bson/bug1839-006.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
--TEST--
PHPC-1839: Referenced, local, non-interned string in typeMap (PHP >= 8.1)
--SKIPIF--
<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
<?php skip_if_php_version('<', '8.1'); ?>
--FILE--
<?php
require_once __DIR__ . "/../utils/basic.inc";

// Assemble the string so as to not have an interned string
$rootValue = chr(ord('a')) . 'rray';
$documentValue = chr(ord('a')) . 'rray';

$typemap = ['root' => &$rootValue, 'document' => &$documentValue];
$bson = MongoDB\BSON\fromPhp((object) []);

echo "Before:\n";
debug_zval_dump($typemap);

MongoDB\BSON\toPHP($bson, $typemap);

echo "After:\n";
debug_zval_dump($typemap);

?>
===DONE===
<?php exit(0); ?>
--EXPECT--
Before:
array(2) refcount(2){
["root"]=>
reference refcount(2) {
string(5) "array" refcount(1)
}
["document"]=>
reference refcount(2) {
string(5) "array" refcount(1)
}
}
After:
array(2) refcount(2){
["root"]=>
reference refcount(2) {
string(5) "array" refcount(1)
}
["document"]=>
reference refcount(2) {
string(5) "array" refcount(1)
}
}
===DONE===
57 changes: 57 additions & 0 deletions tests/bson/bug1839-007.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
--TEST--
PHPC-1839: Referenced, out-of-scope, interned string in typeMap (PHP >= 8.1)
--SKIPIF--
<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
<?php skip_if_php_version('<', '8.1'); ?>
--FILE--
<?php
require_once __DIR__ . "/../utils/basic.inc";

function createTypemap()
{
$rootValue = 'array';
$documentValue = 'array';

$typemap = ['root' => &$rootValue, 'document' => &$documentValue];

return $typemap;
}

$typemap = createTypemap();
$bson = MongoDB\BSON\fromPhp((object) []);

echo "Before:\n";
debug_zval_dump($typemap);

MongoDB\BSON\toPHP($bson, $typemap);

echo "After:\n";
debug_zval_dump($typemap);

?>
===DONE===
<?php exit(0); ?>
--EXPECT--
Before:
array(2) refcount(2){
["root"]=>
reference refcount(1) {
string(5) "array" interned
}
["document"]=>
reference refcount(1) {
string(5) "array" interned
}
}
After:
array(2) refcount(2){
["root"]=>
reference refcount(1) {
string(5) "array" interned
}
["document"]=>
reference refcount(1) {
string(5) "array" interned
}
}
===DONE===
50 changes: 50 additions & 0 deletions tests/bson/bug1839-008.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
--TEST--
PHPC-1839: Referenced, local, interned string in typeMap (PHP >= 8.1)
--SKIPIF--
<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
<?php skip_if_php_version('<', '8.1'); ?>
--FILE--
<?php
require_once __DIR__ . "/../utils/basic.inc";

$rootValue = 'array';
$documentValue = 'array';

$typemap = ['root' => &$rootValue, 'document' => &$documentValue];
$bson = MongoDB\BSON\fromPhp((object) []);

echo "Before:\n";
debug_zval_dump($typemap);

MongoDB\BSON\toPHP($bson, $typemap);

echo "After:\n";
debug_zval_dump($typemap);

?>
===DONE===
<?php exit(0); ?>
--EXPECT--
Before:
array(2) refcount(2){
["root"]=>
reference refcount(2) {
string(5) "array" interned
}
["document"]=>
reference refcount(2) {
string(5) "array" interned
}
}
After:
array(2) refcount(2){
["root"]=>
reference refcount(2) {
string(5) "array" interned
}
["document"]=>
reference refcount(2) {
string(5) "array" interned
}
}
===DONE===
2 changes: 1 addition & 1 deletion tests/bulk/bulkwrite_error-001.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ class MyBulkWrite extends MongoDB\Driver\BulkWrite {}
===DONE===
<?php exit(0); ?>
--EXPECTF--
Fatal error: Class MyBulkWrite may not inherit from final class (MongoDB\Driver\BulkWrite) in %s on line %d
Fatal error: Class MyBulkWrite %s final class %SMongoDB\Driver\BulkWrite%S in %s on line %d
2 changes: 1 addition & 1 deletion tests/command/command_error-001.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ class MyCommand extends MongoDB\Driver\Command {}
===DONE===
<?php exit(0); ?>
--EXPECTF--
Fatal error: Class MyCommand may not inherit from final class (MongoDB\Driver\Command) in %s on line %d
Fatal error: Class MyCommand %s final class %SMongoDB\Driver\Command%S in %s on line %d
2 changes: 1 addition & 1 deletion tests/cursor/cursor_error-001.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ class MyCursor extends MongoDB\Driver\Cursor {}
===DONE===
<?php exit(0); ?>
--EXPECTF--
Fatal error: Class MyCursor may not inherit from final class (MongoDB\Driver\Cursor) in %s on line %d
Fatal error: Class MyCursor %s final class %SMongoDB\Driver\Cursor%S in %s on line %d
2 changes: 1 addition & 1 deletion tests/cursorid/cursorid_error-001.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ class MyCursorId extends MongoDB\Driver\CursorId {}
===DONE===
<?php exit(0); ?>
--EXPECTF--
Fatal error: Class MyCursorId may not inherit from final class (MongoDB\Driver\CursorId) in %s on line %d
Fatal error: Class MyCursorId %s final class %SMongoDB\Driver\CursorId%S in %s on line %d
2 changes: 1 addition & 1 deletion tests/manager/manager_error-001.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ class MyManager extends MongoDB\Driver\Manager {}
===DONE===
<?php exit(0); ?>
--EXPECTF--
Fatal error: Class MyManager may not inherit from final class (MongoDB\Driver\Manager) in %s on line %d
Fatal error: Class MyManager %s final class %SMongoDB\Driver\Manager%S in %s on line %d
2 changes: 1 addition & 1 deletion tests/query/query_error-001.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ class MyQuery extends MongoDB\Driver\Query {}
===DONE===
<?php exit(0); ?>
--EXPECTF--
Fatal error: Class MyQuery may not inherit from final class (MongoDB\Driver\Query) in %s on line %d
Fatal error: Class MyQuery %s final class %SMongoDB\Driver\Query%S in %s on line %d
2 changes: 1 addition & 1 deletion tests/readConcern/readconcern_error-001.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ class MyReadConcern extends MongoDB\Driver\ReadConcern {}
===DONE===
<?php exit(0); ?>
--EXPECTF--
Fatal error: Class MyReadConcern may not inherit from final class (MongoDB\Driver\ReadConcern) in %s on line %d
Fatal error: Class MyReadConcern %s final class %SMongoDB\Driver\ReadConcern%S in %s on line %d
2 changes: 1 addition & 1 deletion tests/readPreference/readpreference_error-001.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ class MyReadPreference extends MongoDB\Driver\ReadPreference {}
===DONE===
<?php exit(0); ?>
--EXPECTF--
Fatal error: Class MyReadPreference may not inherit from final class (MongoDB\Driver\ReadPreference) in %s on line %d
Fatal error: Class MyReadPreference %s final class %SMongoDB\Driver\ReadPreference%S in %s on line %d
Loading