Skip to content

Conversation

remicollet
Copy link
Contributor

@remicollet remicollet commented Jul 30, 2025

  • Zend/zend_smart_string.h exists since 7.2
  • ext/standard/php_smart_string.h removed in 8.5.0alpha3

Summary by CodeRabbit

  • Chores
    • Improved compatibility with different PHP versions.

Copy link

coderabbitai bot commented Jul 30, 2025

Walkthrough

The update modifies the inclusion of a header file in zstd.c to conditionally select the correct smart string header based on the PHP version, ensuring compatibility with both pre-7.2.0 and 7.2.0+ PHP environments.

Changes

Cohort / File(s) Change Summary
PHP Smart String Header Conditional
zstd.c
Added conditional inclusion to select the appropriate smart string header for different PHP versions.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Poem

A header here, a header there,
PHP versions handled with care.
If older, use the path of old,
If newer, Zend’s header is told.
A simple tweak, a gentle nudge—
Now all compilers bear no grudge!
🐇✨

Note

⚡️ Unit Test Generation is now available in beta!

Learn more here, or try it out under "Finishing Touches" below.

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
zstd.c (1)

33-37: Use angle-brackets for Zend header to avoid accidental local-file shadowing

Core and bundled extensions consistently include Zend headers with the system-style form:

#include <Zend/zend_smart_string.h>

Keeping the same style:

  1. Prevents the compiler from searching the current directory first (quotes form), which could accidentally resolve to an unrelated file if one appears in the build tree.
  2. Aligns with the immediately-following include <zend_smart_str.h>.

Diff:

-#include "Zend/zend_smart_string.h"
+#include <Zend/zend_smart_string.h>
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 19f9cbc and 96d5dce.

📒 Files selected for processing (1)
  • zstd.c (1 hunks)
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: thekid
PR: kjdev/php-ext-zstd#77
File: zstd.stub.php:13-22
Timestamp: 2025-04-20T19:39:56.258Z
Learning: The php-ext-zstd library aims to maintain compatibility with PHP 7, so PHP 8-specific syntax features like union types should be avoided in favor of PHPDoc annotations.
zstd.c (1)

Learnt from: thekid
PR: #77
File: zstd.stub.php:13-22
Timestamp: 2025-04-20T19:39:56.258Z
Learning: The php-ext-zstd library aims to maintain compatibility with PHP 7, so PHP 8-specific syntax features like union types should be avoided in favor of PHPDoc annotations.

🔇 Additional comments (1)
zstd.c (1)

33-37: Version guard is fine, but double-check your intent

php_smart_string.h disappeared only in PHP 8.5, so both headers are available for PHP 7.2 – 8.4.
The current guard (< 70200) selects the new header for everything 7.2+. That’s perfectly safe, but if maximum flexibility is desired you could switch on header presence instead of the PHP version macro.

Just confirm this matches the compatibility matrix you want to support.

@kjdev kjdev merged commit e061583 into kjdev:master Jul 31, 2025
95 checks passed
@kjdev
Copy link
Owner

kjdev commented Jul 31, 2025

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants