fix: fix object compare result php74 != bc - #84
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR aims to fix mismatches between PHP 7.4 native object comparison behavior and the colopl_bc compatibility layer, and to add regression tests around the compare diagnostics modes to ensure objects aren’t replaced during comparison.
Changes:
- Updates the PHP 7.4 compare implementation to enable “native snapshot compare” in more cases (including certain safe objects) and adds a std-object fast-path comparison.
- Adds PHPT regression tests for compare diagnostics in log and deprecated modes.
- Includes minor refactors/touch-ups in array key/data compare helpers while adjusting compare internals.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 6 comments.
| File | Description |
|---|---|
ext/colopl_bc_php74.c |
Adjusts legacy compare behavior and snapshot eligibility logic for PHP 7.4 comparisons. |
ext/tests/php74/object_compare_log_snapshot_log.phpt |
Adds a regression test for log-mode diagnostics without object replacement. |
ext/tests/php74/object_compare_log_snapshot_deprecated.phpt |
Adds a regression test for deprecated-mode diagnostics without object replacement. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+32
to
+37
| before a:1 | ||
| before b:2 | ||
| Incompatible compare detected in %s on line %d | ||
| bool(true) | ||
| after a:1 | ||
| after b:2 |
Comment on lines
+32
to
+38
| before a:1 | ||
| before b:2 | ||
|
|
||
| Deprecated: Colopl\ColoplBc\Php74\eq(): Incompatible compare detected in %s on line %d | ||
| bool(true) | ||
| after a:1 | ||
| after b:2 |
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
require bump 14.x