8000 [Debug] Symfony debug extension by nicolas-grekas · Pull Request #10500 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[Debug] Symfony debug extension #10500

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

Closed
wants to merge 2 commits into from

Conversation

nicolas-grekas
Copy link
Member
Q A
Bug fix? no
New feature? yes
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets none
License MIT
Doc PR none

Add a symfony_zval_info($key, $array, $options = 0) function in a PHP extension written in C, that:

  • exposes zval_hash/refcount, allowing efficient exploration of arbitrary structure in PHP,
  • does work with references, preventing memory copying.

Please see the provided README for more info.

@@ -0,0 +1,21 @@
<?php
$br = (php_sapi_name() == "cli")? "":"<br>";
Copy link
Contributor

Choose a reason for hiding this comment

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

missing headers?

@jpauli jpauli mentioned this pull request Mar 20, 2014
@Tobion
Copy link
Contributor
Tobion commented Mar 20, 2014

What's the relation to symfony?

@nicolas-grekas
Copy link
Member Author

The first short term use of this function is porting https://github.com/nicolas-grekas/Patchwork-Dumper to Symfony Debug component. With a target for enhancing the debug toolbar. Patchwork Dumper relies on an algorithm that allows exploring soft and hard references in arbitrary PHP structures. But PHP has no primitive to make this happen easily (== fast and memory efficient).
With this function, we add this missing simple primitive.
We also have other ideas with Julien to add more debug functions in this extension, that could lead to better debugging of memory leaks for example.

@stof
Copy link
Member
stof commented Mar 21, 2014

Given that such extension does not have any PHP counter-part, I find it weird to include it in the same repo than the PHP code while it requires a separate installation process (for Twig, the same feature is provided without the extension and the algorithms must stay in sync, so it is fine to have it in the repo).

Thus, the function is not even specific to Symfony. So IMO, it should be maintained in a separate repo (or even contributed to XDebug if possible, to have a single debugging extension instead of 2).
Btw, how does this function relate to xdebug_debug_zval ?

@Tobion
Copy link
Contributor
Tobion commented Mar 21, 2014

I also don't really think it belongs into symfony since it's not symfony specific.

@jpauli
Copy link
jpauli commented Mar 21, 2014

We've been told to merge it here by @fabpot , so let's wait for his answer, so that he will clarify all this. Thx.

@nicolas-grekas
Copy link
Member Author

I didn't explain well: the dumper is already implemented in pure PHP. That won't change. And when this extension is enabled, it could be used to gain a LOT of performance. This compares to the twig extension on this point: not required, but you gain perf. when enabled.

Does it belong to Symfony? What is Symfony? It's not a full stack framework. We are talking here of the Debug component. Symfony is dedicated to give powerful tools to PHP developers. A debug extension, that hooks into the PHP engine to give more information to devs is a very good thing.

For your question about xdebug_debug_zval, it's different in many way: It gives new information that is not available in PHP (zval_hash). That is of premium use for a dumper. Moreover, it is not targeted at one specific use (it does no output but returns an array). That means that even if I personally plan to use it for dumping efficiently, anyone else can come with an other use case, or a better dumper, and build something cool upon it. That! is powerfulness :)

@lyrixx
Copy link
Member
lyrixx commented Mar 21, 2014

👍

@stof
Copy link
Member
stof commented Mar 21, 2014

@nicolas-grekas I don't disagree about having it as part of Symfony (I suggested contributing it to XDebug to have a single debugging extension needing to be installed, but this is not a blocker for me). But IMO, the C extension should probably live inside its own repo

@nicolas-grekas
Copy link
Member Author

Replaced by #10640

@nicolas-grekas nicolas-grekas deleted the debug_ext branch April 5, 2014 21:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants
0