No Description

README.rst 2.1KB

    <h1>Symfony Debug Extension</h1> <p>This extension adds a <code>symfony_zval_info($key, $array, $options = 0)</code> function that:</p> <ul> <li>exposes zval_hash/refcounts, allowing e.g. efficient exploration of arbitrary structures in PHP,</li> <li>does work with references, preventing memory copying.</li> </ul> <p>Its behavior is about the same as:</p> <p>.. code-block:: php</p> <pre><code>&lt;?php function symfony_zval_info($key, $array, $options = 0) { // $options is currently not used, but could be in future version. if (!array_key_exists($key, $array)) { return null; } $info = array( &#39;type&#39; =&gt; gettype($array[$key]), &#39;zval_hash&#39; =&gt; /* hashed memory address of $array[$key] */, &#39;zval_refcount&#39; =&gt; /* internal zval refcount of $array[$key] */, &#39;zval_isref&#39; =&gt; /* is_ref status of $array[$key] */, ); switch ($info[&#39;type&#39;]) { case &#39;object&#39;: $info += array( &#39;object_class&#39; =&gt; get_class($array[$key]), &#39;object_refcount&#39; =&gt; /* internal object refcount of $array[$key] */, &#39;object_hash&#39; =&gt; spl_object_hash($array[$key]), &#39;object_handle&#39; =&gt; /* internal object handle $array[$key] */, ); break; case &#39;resource&#39;: $info += array( &#39;resource_handle&#39; =&gt; (int) $array[$key], &#39;resource_type&#39; =&gt; get_resource_type($array[$key]), &#39;resource_refcount&#39; =&gt; /* internal resource refcount of $array[$key] */, ); break; case &#39;array&#39;: $info += array( &#39;array_count&#39; =&gt; count($array[$key]), ); break; case &#39;string&#39;: $info += array( &#39;strlen&#39; =&gt; strlen($array[$key]), ); break; } return $info; } </code></pre> <p>To enable the extension from source, run:</p> <p>.. code-block:: sh</p> <pre><code>phpize ./configure make sudo make install </code></pre>