"Fossies" - the Fresh Open Source Software Archive

Member "forkcms/vendor/symfony/symfony/src/Symfony/Component/Debug/Resources/ext/tests/001.phpt" (5 Dec 2019, 2652 Bytes) of package /linux/www/forkcms-5.7.1.tar.gz:


As a special service "Fossies" has tried to format the requested text file into HTML format (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file.

    1 --TEST--
    2 Test symfony_zval_info API
    3 --SKIPIF--
    4 <?php if (!extension_loaded('symfony_debug')) {
    5     echo 'skip';
    6 } ?>
    7 --FILE--
    8 <?php
    9 
   10 $int = 42;
   11 $float = 42.42;
   12 $str = 'foobar';
   13 $object = new StdClass();
   14 $array = ['foo', 'bar'];
   15 $resource = tmpfile();
   16 $null = null;
   17 $bool = true;
   18 
   19 $anotherint = 42;
   20 $refcount2 = &$anotherint;
   21 
   22 $var = [
   23     'int' => $int,
   24     'float' => $float,
   25     'str' => $str,
   26     'object' => $object,
   27     'array' => $array,
   28     'resource' => $resource,
   29     'null' => $null,
   30     'bool' => $bool,
   31     'refcount' => &$refcount2,
   32 ];
   33 
   34 var_dump(symfony_zval_info('int', $var));
   35 var_dump(symfony_zval_info('float', $var));
   36 var_dump(symfony_zval_info('str', $var));
   37 var_dump(symfony_zval_info('object', $var));
   38 var_dump(symfony_zval_info('array', $var));
   39 var_dump(symfony_zval_info('resource', $var));
   40 var_dump(symfony_zval_info('null', $var));
   41 var_dump(symfony_zval_info('bool', $var));
   42 
   43 var_dump(symfony_zval_info('refcount', $var));
   44 var_dump(symfony_zval_info('not-exist', $var));
   45 ?>
   46 --EXPECTF--
   47 array(4) {
   48   ["type"]=>
   49   string(7) "integer"
   50   ["zval_hash"]=>
   51   string(16) "%s"
   52   ["zval_refcount"]=>
   53   int(2)
   54   ["zval_isref"]=>
   55   bool(false)
   56 }
   57 array(4) {
   58   ["type"]=>
   59   string(6) "double"
   60   ["zval_hash"]=>
   61   string(16) "%s"
   62   ["zval_refcount"]=>
   63   int(2)
   64   ["zval_isref"]=>
   65   bool(false)
   66 }
   67 array(5) {
   68   ["type"]=>
   69   string(6) "string"
   70   ["zval_hash"]=>
   71   string(16) "%s"
   72   ["zval_refcount"]=>
   73   int(2)
   74   ["zval_isref"]=>
   75   bool(false)
   76   ["strlen"]=>
   77   int(6)
   78 }
   79 array(8) {
   80   ["type"]=>
   81   string(6) "object"
   82   ["zval_hash"]=>
   83   string(16) "%s"
   84   ["zval_refcount"]=>
   85   int(2)
   86   ["zval_isref"]=>
   87   bool(false)
   88   ["object_class"]=>
   89   string(8) "stdClass"
   90   ["object_refcount"]=>
   91   int(1)
   92   ["object_hash"]=>
   93   string(32) "%s"
   94   ["object_handle"]=>
   95   int(%d)
   96 }
   97 array(5) {
   98   ["type"]=>
   99   string(5) "array"
  100   ["zval_hash"]=>
  101   string(16) "%s"
  102   ["zval_refcount"]=>
  103   int(2)
  104   ["zval_isref"]=>
  105   bool(false)
  106   ["array_count"]=>
  107   int(2)
  108 }
  109 array(7) {
  110   ["type"]=>
  111   string(8) "resource"
  112   ["zval_hash"]=>
  113   string(16) "%s"
  114   ["zval_refcount"]=>
  115   int(2)
  116   ["zval_isref"]=>
  117   bool(false)
  118   ["resource_handle"]=>
  119   int(%d)
  120   ["resource_type"]=>
  121   string(6) "stream"
  122   ["resource_refcount"]=>
  123   int(1)
  124 }
  125 array(4) {
  126   ["type"]=>
  127   string(4) "NULL"
  128   ["zval_hash"]=>
  129   string(16) "%s"
  130   ["zval_refcount"]=>
  131   int(2)
  132   ["zval_isref"]=>
  133   bool(false)
  134 }
  135 array(4) {
  136   ["type"]=>
  137   string(7) "boolean"
  138   ["zval_hash"]=>
  139   string(16) "%s"
  140   ["zval_refcount"]=>
  141   int(2)
  142   ["zval_isref"]=>
  143   bool(false)
  144 }
  145 array(4) {
  146   ["type"]=>
  147   string(7) "integer"
  148   ["zval_hash"]=>
  149   string(16) "%s"
  150   ["zval_refcount"]=>
  151   int(3)
  152   ["zval_isref"]=>
  153   bool(true)
  154 }
  155 NULL