Skip to content

PHPLIB-1996: PHP 8.6 compatibility migration - #2078

Merged
GromNaN merged 6 commits into
mongodb:v2.5from
Visualq:feature/php86-migration
Nov 16, 2026
Merged

GromNaN merged 6 commits into
mongodb:v2.5from
Visualq:feature/php86-migration

Conversation

@Visualq

@Visualq Visualq commented Nov 16, 2026

Copy link
Copy Markdown
Contributor

Add PHP 8.6 to CI, replace is_integer() with is_int(), and replace deprecated SplObjectStorage aliases.

The ArrayObject object-backing deprecation remains open: tests on PHP 8.5 and 8.6 confirm that casting BSONDocument's stdClass input to an array breaks bidirectional propagation of updates, additions, and deletions; resolving this requires a separate compatibility decision.

AI was used to verify the correctness of this merge request.

@Visualq
Visualq requested a review from a team as a code owner November 16, 2026 16:34
@Visualq
Visualq requested a review from paulinevos November 16, 2026 16:34
@GromNaN GromNaN changed the title PHP 8.6 compatibility migration PHPLIB-1996: PHP 8.6 compatibility migration Nov 16, 2026
@GromNaN

GromNaN commented Nov 16, 2026

Copy link
Copy Markdown
Member

Thank you @Visualq, this is really appreciated. We almost forgot to test our lib with PHP 8.6.

@GromNaN GromNaN added the bug a bug fix label Nov 16, 2026
@GromNaN
GromNaN changed the base branch from v2.x to v2.5 November 16, 2026 16:56
@GromNaN
GromNaN changed the base branch from v2.5 to v2.x November 16, 2026 16:57
@codecov-commenter

This comment was marked as resolved.

@GromNaN
GromNaN changed the base branch from v2.x to v2.5 November 16, 2026 16:58
@GromNaN
GromNaN requested review from GromNaN and removed request for paulinevos November 16, 2026 16:59
@GromNaN
GromNaN force-pushed the feature/php86-migration branch from 9f9dd35 to 4912904 Compare November 16, 2026 17:04
PHP 8.6 makes fclose() and file_put_contents() return false when the wrapper does not implement stream_flush().
@GromNaN
GromNaN force-pushed the feature/php86-migration branch from 6fb98c4 to e248566 Compare November 16, 2026 17:35
driver-version: ${{ matrix.driver-version || 'stable' }}
php-ini-values: "zend.assertions=1"
ignore-platform-req: ${{ matrix.php-version == '8.5' && 'true' || 'false' }}
ignore-platform-req: ${{ matrix.php-version == '8.6' && 'true' || 'false' }}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This is a restriction from psalm. It's now compatible with PHP 8.5.

*
* @see https://php.net/manual/en/streamwrapper.stream-flush.php
*/
public function stream_flush(): bool

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

fflush() returned false on every supported PHP version before this method existed, and now returns true. Data is still buffered until the stream is closed, so the flush is a no-op, but the return value change is not limited to PHP 8.6.

@GromNaN
GromNaN merged commit 64524ae into mongodb:v2.5 Nov 16, 2026
40 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug a bug fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants