Skip to content
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

Work around preloaded enums being broken on early PHP 8.4 versions with observers #3093

Merged
merged 1 commit into from
Feb 20, 2025

Conversation

bwoebi
Copy link
Collaborator

@bwoebi bwoebi commented Feb 17, 2025

See also php/php-src#17715.

Relatively simple fix: just initialize the cache slots on every request. Has a slight per request-overhead, but avoids crashes when SomePreloadedEnum::cases().

Not adding a test, it's covered by preload_enum_observed.phpt from php-src.

@bwoebi bwoebi requested a review from a team as a code owner February 17, 2025 16:40
@bwoebi bwoebi force-pushed the bob/init-enum-slots branch from 4a435fe to 66c9e1d Compare February 17, 2025 16:43
@codecov-commenter
Copy link

codecov-commenter commented Feb 17, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 73.04%. Comparing base (368a541) to head (0590f35).
Report is 1 commits behind head on master.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff            @@
##             master    #3093   +/-   ##
=========================================
  Coverage     73.04%   73.04%           
  Complexity     2792     2792           
=========================================
  Files           139      139           
  Lines         15284    15284           
  Branches       1047     1047           
=========================================
  Hits          11164    11164           
  Misses         3567     3567           
  Partials        553      553           
Flag Coverage Δ
appsec-extension 68.28% <ø> (ø)
tracer-php 74.86% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 368a541...0590f35. Read the comment docs.

@pr-commenter
Copy link

pr-commenter bot commented Feb 17, 2025

Benchmarks [ tracer ]

Benchmark execution time: 2025-02-20 14:29:31

Comparing candidate commit 0590f35 in PR branch bob/init-enum-slots with baseline commit 368a541 in branch master.

Found 1 performance improvements and 1 performance regressions! Performance is the same for 176 metrics, 0 unstable metrics.

scenario:PDOBench/benchPDOBaseline

  • 🟥 execution_time [+14.701µs; +18.056µs] or [+8.025%; +9.856%]

scenario:TraceFlushBench/benchFlushTrace

  • 🟩 execution_time [-1000.000ns; -1000.000ns] or [-50.000%; -50.000%]

@bwoebi bwoebi force-pushed the bob/init-enum-slots branch 2 times, most recently from 4d33534 to 1c176d0 Compare February 19, 2025 12:50
…th observers

See also php/php-src#17715.

Relatively simple fix: just initialize the cache slots on every request. Has a slight per request-overhead, but avoids crashes when SomePreloadedEnum::cases().

Signed-off-by: Bob Weinand <[email protected]>
@bwoebi bwoebi force-pushed the bob/init-enum-slots branch from 1c176d0 to 0590f35 Compare February 20, 2025 14:01
@bwoebi bwoebi merged commit 3a910f7 into master Feb 20, 2025
792 of 806 checks passed
@bwoebi bwoebi deleted the bob/init-enum-slots branch February 20, 2025 19:54
@github-actions github-actions bot added this to the 1.7.0 milestone Feb 20, 2025
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.

3 participants