Skip to content

Skip signal handler registration when pcntl functions are disabled#508

Merged
freekmurze merged 2 commits into
spatie:mainfrom
poldixd:main
Jun 12, 2026
Merged

Skip signal handler registration when pcntl functions are disabled#508
freekmurze merged 2 commits into
spatie:mainfrom
poldixd:main

Conversation

@poldixd

@poldixd poldixd commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

This merge request fixes an issue on shared hosting.

The crawler checked if the pcntl extension is loaded, but on some shared servers the extension is loaded while the needed functions are disabled.

Because of that, the crawler tried to call pcntl_async_signals() and failed with an error.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 2826d300e9

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/Crawler.php Outdated
if (
! extension_loaded('pcntl') ||
! function_exists('pcntl_async_signals') ||
! function_exists('pcntl_signal')

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Guard unregister path when pcntl_signal is disabled

When pcntl_signal is disabled but the pcntl extension is loaded, this new guard makes registerSignalHandlers() return, but start() still runs the finally block and unregisterSignalHandlers() only checks extension_loaded('pcntl') before calling pcntl_signal. In the shared-hosting configuration this change is meant to support, the crawl still fatals at shutdown with an undefined/disabled pcntl_signal; mirror the guard there or track whether handlers were actually registered before unregistering.

Useful? React with 👍 / 👎.

@freekmurze freekmurze merged commit 3b3a9a1 into spatie:main Jun 12, 2026
4 checks passed
@freekmurze

Copy link
Copy Markdown
Member

Thanks for the fix, @poldixd! Good catch on shared hosting where pcntl is loaded but its functions are disabled. Released in 9.3.2.

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