[ Index ]

PHP Cross Reference of phpBB-3.2.11-deutsch

title

Body

[close]

/vendor/symfony/debug/Resources/ext/ -> README.md (source)

   1  Symfony Debug Extension for PHP 5
   2  =================================
   3  
   4  This extension publishes several functions to help building powerful debugging tools.
   5  It is compatible with PHP 5.3, 5.4, 5.5 and 5.6; with ZTS and non-ZTS modes.
   6  It is not required thus not provided for PHP 7.
   7  
   8  symfony_zval_info()
   9  -------------------
  10  
  11  - exposes zval_hash/refcounts, allowing e.g. efficient exploration of arbitrary structures in PHP,
  12  - does work with references, preventing memory copying.
  13  
  14  Its behavior is about the same as:
  15  
  16  ```php
  17  <?php
  18  
  19  function symfony_zval_info($key, $array, $options = 0)
  20  {
  21  
  22      // $options is currently not used, but could be in future version.
  23  
  24      if (!array_key_exists($key, $array)) {
  25          return null;
  26      }
  27  
  28      $info = array(
  29          'type' => gettype($array[$key]),
  30          'zval_hash' => /* hashed memory address of $array[$key] */,
  31          'zval_refcount' => /* internal zval refcount of $array[$key] */,
  32          'zval_isref' => /* is_ref status of $array[$key] */,
  33      );
  34  
  35      switch ($info['type']) {
  36          case 'object':
  37              $info += array(
  38                  'object_class' => get_class($array[$key]),
  39                  'object_refcount' => /* internal object refcount of $array[$key] */,
  40                  'object_hash' => spl_object_hash($array[$key]),
  41                  'object_handle' => /* internal object handle $array[$key] */,
  42              );
  43              break;
  44  
  45          case 'resource':
  46              $info += array(
  47                  'resource_handle' => (int) $array[$key],
  48                  'resource_type' => get_resource_type($array[$key]),
  49                  'resource_refcount' => /* internal resource refcount of $array[$key] */,
  50              );
  51              break;
  52  
  53          case 'array':
  54              $info += array(
  55                  'array_count' => count($array[$key]),
  56              );
  57              break;
  58  
  59          case 'string':
  60              $info += array(
  61                  'strlen' => strlen($array[$key]),
  62              );
  63              break;
  64      }
  65  
  66      return $info;
  67  }
  68  ```
  69  
  70  symfony_debug_backtrace()
  71  -------------------------
  72  
  73  This function works like debug_backtrace(), except that it can fetch the full backtrace in case of fatal errors:
  74  
  75  ```php
  76  function foo() { fatal(); }
  77  function bar() { foo(); }
  78  
  79  function sd() { var_dump(symfony_debug_backtrace()); }
  80  
  81  register_shutdown_function('sd');
  82  
  83  bar();
  84  
  85  /* Will output
  86  Fatal error: Call to undefined function fatal() in foo.php on line 42
  87  array(3) {
  88    [0]=>
  89    array(2) {
  90      ["function"]=>
  91      string(2) "sd"
  92      ["args"]=>
  93      array(0) {
  94      }
  95    }
  96    [1]=>
  97    array(4) {
  98      ["file"]=>
  99      string(7) "foo.php"
 100      ["line"]=>
 101      int(1)
 102      ["function"]=>
 103      string(3) "foo"
 104      ["args"]=>
 105      array(0) {
 106      }
 107    }
 108    [2]=>
 109    array(4) {
 110      ["file"]=>
 111      string(102) "foo.php"
 112      ["line"]=>
 113      int(2)
 114      ["function"]=>
 115      string(3) "bar"
 116      ["args"]=>
 117      array(0) {
 118      }
 119    }
 120  }
 121  */
 122  ```
 123  
 124  Usage
 125  -----
 126  
 127  To enable the extension from source, run:
 128  
 129  ```
 130      phpize
 131      ./configure
 132      make
 133      sudo make install
 134  ```


Generated: Wed Nov 11 20:33:01 2020 Cross-referenced by PHPXref 0.7.1