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

Sandbox PHP 5.6 using zend_execute_ex + zend_execute_internal #970

Merged
merged 2 commits into from Aug 5, 2020

Conversation

morrisonlevi
Copy link
Collaborator

@morrisonlevi morrisonlevi commented Jul 21, 2020

Description

This PR changes the engine hooks for PHP 5.6 to use zend_execute_ex and zend_execute_internal instead of fcall opcode handlers to instrument functions. This gives us the ability to trace calls made by call_user_func and call_user_func_array, and is vastly simpler. It doesn't support the legacy API at all. The span defaults and close at exit features are supported.

This did require some other changes such as making a ddtrace_span_fci object that backs up various information about the call for the sake of the exit handler. I also deleted some dead code paths on PHP 5.4 because they were giving build errors after making changes.

It also fixes a bug in PHP 5.6+ where args that are references weren't passed into the closure's args array correctly as references.

Readiness checklist

  • Changelog has been added to the appropriate release draft.
  • Tests added for this feature/bug.

Reviewer checklist

  • Appropriate labels assigned.
  • Milestone is set.
  • Changelog has been added to the appropriate release draft.

@morrisonlevi morrisonlevi added 💔 breaking-change 🍏 core Changes to the core tracing functionality c-extension Apply this label to issues and prs related to the C-extension 📦 Sandbox API labels Jul 21, 2020
@morrisonlevi morrisonlevi force-pushed the levi/build/sandbox-only-php-5.6 branch 2 times, most recently from 05ea2ef to af62bd8 Compare July 21, 2020 19:46
@SammyK SammyK added this to the 0.48.0 milestone Jul 21, 2020
@morrisonlevi morrisonlevi marked this pull request as ready for review July 21, 2020 20:05
Copy link
Contributor

@SammyK SammyK left a comment

Choose a reason for hiding this comment

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

Nice work @morrisonlevi! I left a few questions.

src/ext/php5/engine_hooks.c Show resolved Hide resolved
src/ext/php5/engine_hooks.c Show resolved Hide resolved
src/ext/php5/engine_hooks.c Outdated Show resolved Hide resolved
src/ext/php5/engine_hooks.c Show resolved Hide resolved
src/ext/php5_4/engine_hooks.c Show resolved Hide resolved
src/ext/span.h Outdated Show resolved Hide resolved
tests/Integrations/CodeIgniter/V2_2/ExitTest.php Outdated Show resolved Hide resolved
@morrisonlevi morrisonlevi force-pushed the levi/build/sandbox-only-php-5.6 branch from efc2fe1 to fbecce1 Compare July 30, 2020 03:48
SammyK
SammyK previously approved these changes Jul 30, 2020
Copy link
Contributor

@SammyK SammyK left a comment

Choose a reason for hiding this comment

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

Very nice work @morrisonlevi!

Copy link
Contributor

@SammyK SammyK left a comment

Choose a reason for hiding this comment

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

Excellent work @morrisonlevi 💯

@morrisonlevi morrisonlevi merged commit 80a997b into master Aug 5, 2020
@morrisonlevi morrisonlevi deleted the levi/build/sandbox-only-php-5.6 branch August 5, 2020 19:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
💔 breaking-change c-extension Apply this label to issues and prs related to the C-extension 🍏 core Changes to the core tracing functionality 📦 Sandbox API
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants