Drupal investigation

001.phpt 2.6KB

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