本文整理汇总了PHP中debug_zval_dump函数的典型用法代码示例。如果您正苦于以下问题:PHP debug_zval_dump函数的具体用法?PHP debug_zval_dump怎么用?PHP debug_zval_dump使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了debug_zval_dump函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: dl
<?php
if (!extension_loaded("sqlite")) {
dl("sqlite.so");
if (!extension_loaded("sqlite")) {
exit("Please enable SQLite support\n");
}
}
debug_zval_dump(sqlite_libversion());
debug_zval_dump(sqlite_libencoding());
$s = sqlite_open("weztest.sqlite", 0666, $err);
debug_zval_dump($err);
debug_zval_dump($s);
$r = sqlite_query("create table foo (a INTEGER PRIMARY KEY, b INTEGER )", $s);
debug_zval_dump(sqlite_last_error($s));
debug_zval_dump(sqlite_error_string(sqlite_last_error($s)));
$r = sqlite_query("select *, php('md5', sql) as o from sqlite_master", $s);
debug_zval_dump($r);
debug_zval_dump(sqlite_num_rows($r));
debug_zval_dump(sqlite_num_fields($r));
for ($j = 0; $j < sqlite_num_fields($r); $j++) {
echo "Field {$j} is " . sqlite_field_name($r, $j) . "\n";
}
while ($row = sqlite_fetch_array($r, SQLITE_ASSOC)) {
print_r($row);
}
sqlite_close($s);
示例2: dump_globalvar
function dump_globalvar(&$local_var)
{
global $global_var;
echo "\n-- Value of local variable inside dump_globalvar() --\n";
debug_zval_dump($local_var);
echo "\n-- Value of global variable inside dump_globalvar() --\n";
debug_zval_dump($global_var);
}
示例3: zval_dump
function zval_dump($values)
{
$counter = 1;
foreach ($values as $value) {
echo "-- Iteration {$counter} --\n";
debug_zval_dump($value);
$counter++;
}
}
开发者ID:gleamingthecube,项目名称:php,代码行数:9,代码来源:ext_standard_tests_general_functions_debug_zval_dump_o.php
示例4: foo
function foo($ref, $alt)
{
unset($GLOBALS['a']);
unset($GLOBALS['b']);
$GLOBALS['a'] = 1;
$GLOBALS['b'] = 2;
$org_a = $GLOBALS['a'];
$org_b = $GLOBALS['b'];
if ($ref) {
global $a, $b;
} else {
/* zval temp_var(NULL); // refcount = 1
* a = temp_var[x] // refcount = 2
*/
$a = NULL;
$b = NULL;
}
debug_zval_dump($a, $b, $GLOBALS['a'], $GLOBALS['b']);
echo "--\n";
if ($alt) {
$a =& $GLOBALS['a'];
$b =& $GLOBALS['b'];
} else {
extract($GLOBALS, EXTR_REFS);
}
debug_zval_dump($a, $b, $GLOBALS['a'], $GLOBALS['b']);
echo "--\n";
$a =& $GLOBALS['a'];
$b =& $GLOBALS['b'];
debug_zval_dump($a, $b, $GLOBALS['a'], $GLOBALS['b']);
echo "--\n";
$GLOBALS['b'] = 3;
debug_zval_dump($a, $b, $GLOBALS['a'], $GLOBALS['b']);
echo "--\n";
$a = 4;
debug_zval_dump($a, $b, $GLOBALS['a'], $GLOBALS['b']);
echo "--\n";
$c = $b;
debug_zval_dump($b, $GLOBALS['b'], $c);
echo "--\n";
$b = 'x';
debug_zval_dump($a, $b, $GLOBALS['a'], $GLOBALS['b'], $c);
echo "--\n";
debug_zval_dump($org_a, $org_b);
echo "----";
if ($ref) {
echo 'r';
}
if ($alt) {
echo 'a';
}
echo "\n";
}
示例5: on_accept
function on_accept($stream, $flags, $event)
{
global $CLIENTS;
$mem = memory_get_usage();
echo "on_accept({$stream}, {$flags}): mem={$mem} \n";
if (false === ($con = stream_socket_accept($stream, 0, $name))) {
echo "Accept failed\n";
} else {
echo "Peer:{$name}\n";
$client = bufferevent_new($con, 'on_read', 'on_write', 'on_error');
debug_zval_dump($client);
// TODO: If bufferevent falls out of scope: disable and free buffer. also close stream.
$CLIENTS[$name] = array(&$client, &$con);
bufferevent_enable($client, EV_READ);
}
}
示例6: get
public function get($uid)
{
// hprint(debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS));
// debug_print_backtrace();
// go(); xdebug;
$a = array('a' => 'a');
debug_zval_dump($a);
die;
import('Mc');
$mc = Mc::getInstance();
hprint($mc);
$mc->increment('aa', 1);
$res = $mc->get('aa');
echo $res;
echo '<br>';
//print_r($user->get());
}
示例7: init
/**
* Inits class
*/
private static function init()
{
if (null !== self::$offset) {
return;
}
// calculate offset and mask
self::$offset = 16 - PHP_INT_SIZE;
self::$mask = -1;
$tested = (object) array();
if (defined('HHVM_VERSION')) {
// HHVM specific
self::$offset += 16;
} else {
// determine the mask to apply to object hashes
ob_start();
debug_zval_dump($tested);
$debug = ob_get_clean();
self::$mask = (int) substr($debug, strpos($debug, "#") + 1);
}
$relevantInt = self::getObjectHashRelevantInt($tested);
self::$mask ^= $relevantInt;
}
示例8: detect_circular_references
/**
* Simple test for circular references
* Example: detect_circular_references(get_defined_vars());
* Currently tries to detect recursion within objects
* @param mixed $vars
* @param array $refs
* @param array $objrefs
*/
function detect_circular_references($vars = array(), &$refs = array(), &$objrefs = array())
{
foreach ($vars as $name => $var) {
if (is_array($var)) {
detect_circular_references($var, $refs, $objrefs);
} else {
if (is_object($var)) {
ob_start();
debug_zval_dump($var);
$dump = ob_get_clean();
if (strpos($dump, '*RECURSION*') !== false) {
//echo '*RECURSION*';
throw new CircularReferenceException('Circular reference in $' . $name);
}
/* $ref = spl_object_hash($var);
if (isset($objrefs[$ref])){
throw new CircularReferenceException();
}
$objrefs[$ref] = true;
$reflection = new ReflectionObject($var);
$properties = $reflection->getProperties();
$pvars = array();
foreach ($properties as $property) {
if (version_compare(PHP_VERSION, '5.3', '>=')) {
$property->setAccessible(true); // PHP 5.3
$pvars[] = $property->getValue();
} else {
if ($property->isPublic()) {
$pvars[] = $property->getValue();
}
}
}
detect_circular_references($pvars, $refs, $objrefs); */
}
}
}
}
示例9: array
require_once 'table.inc';
$references = array();
if (!mysqli_real_query($link, "SELECT id, label FROM test ORDER BY id ASC LIMIT 1") || !($res = mysqli_store_result($link))) {
printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
}
$idx = 0;
while ($row = mysqli_fetch_assoc($res)) {
/* will overwrite itself */
$references[$idx]['row_ref'] =& $row;
$references[$idx]['row_copy'] = $row;
$references[$idx]['id_ref'] =& $row['id'];
$references[$idx++]['id_copy'] = $row['id'];
}
debug_zval_dump($references);
mysqli_free_result($res);
if (!mysqli_real_query($link, "SELECT id, label FROM test ORDER BY id ASC LIMIT 2") || !($res = mysqli_use_result($link))) {
printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
}
$rows = array();
for ($i = 0; $i < 2; $i++) {
$rows[$i] = mysqli_fetch_assoc($res);
$references[$idx]['row_ref'] =& $rows[$i];
$references[$idx]['row_copy'] = $rows[$i];
$references[$idx]['id_ref'] =& $rows[$i]['id'];
$references[$idx]['id_copy'] = $rows[$i]['id'];
/* enforce separation */
$references[$idx]['id_copy_mod'] = $rows[$i]['id'] + 0;
}
mysqli_free_result($res);
debug_zval_dump($references);
print "done!";
示例10: __call
function __call($name, $args)
{
debug_zval_dump($args);
call_user_func_array('foo', $args);
}
示例11: array
<?php
$a = array();
$b =& $a;
$a[0] = $a;
debug_zval_dump($a);
$a = array(array());
$b =& $a;
$a[0][0] = $a;
debug_zval_dump($a);
示例12: putenv
<?php
if (getenv('REDIR_TEST_DIR') === false) {
putenv('REDIR_TEST_DIR=' . dirname(__FILE__) . '/../../pdo/tests/');
}
require_once getenv('REDIR_TEST_DIR') . 'pdo_test.inc';
$db = PDOTest::factory();
try {
$ser = serialize($db);
debug_zval_dump($ser);
$db = unserialize($ser);
$db->exec('CREATE TABLE test (id int NOT NULL PRIMARY KEY, val VARCHAR(10))');
} catch (Exception $e) {
echo "Safely caught " . $e->getMessage() . "\n";
}
echo "PHP Didn't crash!\n";
示例13: array
$row = array('id' => -1, '_bin' => -1, 'bit_value' => -1, '_bit_value0' => -1, 'bit_null' => -1);
if (!mysqli_stmt_bind_result($stmt_sel, $row['id'], $row['_bin'], $row['bit_value'], $row['_bit_value0'], $row['bit_null'])) {
printf("[010 - %d] [%d] %s\n", $bits, mysqli_stmt_errno($stmt_sel), mysqli_stmt_error($stmt_sel));
break;
}
if (!($ret = mysqli_stmt_fetch($stmt_sel))) {
printf("[011 - %d] mysqli_stmt_fetch() has failed for %d bits - ret = %s/%s, [%d] %s, [%d] %s\n", $bits, $bits, gettype($ret), $ret, mysqli_stmt_errno($stmt_sel), mysqli_stmt_error($stmt_sel), mysqli_errno($link_sel), mysqli_errno($link_sel));
break;
}
if ($value != $row['id'] || $bin != $row['_bin'] && $bin2 != $row['_bin']) {
debug_zval_dump($row);
printf("[012 - %d] Insert of %s in BIT(%d) column might have failed. id = %s, bin = %s (%s/%s)\n", $bits, $value, $bits, $row['id'], $row['_bin'], $bin, $bin2);
break;
}
if ($value != $row['bit_value']) {
debug_zval_dump($row);
printf("[013 - %d] Expecting %s got %s\n", $bits, $value, $row['bit_value']);
break;
}
if (null !== $row['bit_null']) {
debug_zval_dump($row);
printf("[014 - %d] Expecting null got %s/%s\n", $bits, gettype($row['bit_value']), $row['bit_value']);
break;
}
}
mysqli_stmt_close($stmt_ins);
mysqli_stmt_close($stmt_sel);
}
mysqli_close($link_ins);
mysqli_close($link_sel);
print "done!";
示例14: checkDuplicities
function checkDuplicities(&$menu, $msg = '')
{
echo "<br />\n" . $msg . "<br />\n";
// joomla defines duplicity as client_id, parent_id, alias, language
$arr = array();
foreach ($menu as $key => &$item) {
$str = $item['client_id'] . '-' . $item['parent_id'] . '-' . $item['alias'] . '-' . $item['language'];
if (isset($arr[$str])) {
$count = 1;
$item['alias'] = $item['alias'] . '-' . $count;
$this->tryAlias($menu, $item, $count);
$str = $item['client_id'] . '-' . $item['parent_id'] . '-' . $item['alias'] . '-' . $item['language'];
}
$arr[$str] = $key;
}
$test = array();
$lftrgt = array();
foreach ($menu as $m1) {
// if (empty($m1['parent_id'])) continue;
// skip for root
if (!empty($m1['parent_id'])) {
$left = $m1['lft'];
$right = $menu[$m1['parent_id']]['rgt'];
if ($right <= $left) {
$msg = "<br />\n" . 'parent id ' . $m1['parent_id'] . "<br />\n";
$msg .= ' right for parent: ' . $right . "<br />\n";
$msg .= ' left for item: ' . $left . " right for item " . $m1['rgt'] . " <br />\n";
$msg .= ' for item id ' . $m1['id'] . "<br />\n";
$msg .= ' error consistency right smaller left';
echo 'item:';
var_dump($m1);
echo 'parent:';
var_dump($menu[$m1['parent_id']]);
die('error consistency right smaller left' . $msg);
}
}
if (!isset($lftrgt[$m1['lft']])) {
$lftrgt[$m1['lft']] = $m1['id'];
//if ($m1['lft']===0) die('ok');
} else {
echo 'id ' . $m1['id'] . ' shares the same left with ' . $lftrgt[$m1['lft']] . "<br />\n";
debug_zval_dump($menu);
die('shares...');
}
if (!isset($lftrgt[$m1['rgt']])) {
$lftrgt[$m1['rgt']] = $m1['id'];
} else {
echo 'id ' . $m1['id'] . ' shares the same right with ' . $lftrgt[$m1['rgt']] . "<br />\n";
echo ' count ' . count($menu);
//debug_zval_dump($menu);
die('shares the same right with.');
}
}
//var_dump($menu[1]);
// -1 because we start from 0
$c = count($menu) * 2 - 1;
for ($i = 0; $i < $c; $i++) {
if (!isset($lftrgt[$i])) {
echo ' 2: missing value for left or right on position ' . $i . "<br />\n";
echo 'count: ' . count($menu);
echo 'before: ';
var_dump($menu[$lftrgt[$i - 1]]);
echo 'next: ';
if (!isset($menu[$lftrgt[$i + 1]])) {
var_dump($menu[1]);
}
var_dump($menu[$lftrgt[$i + 1]]);
var_dump($menu[$lftrgt[$i + 2]]);
//var_dump($menu[685]);
die('2: missing');
}
}
}
示例15: getReferenceCount
/**
* @param object $value
* @param bool $includeCurrent
*
* @return int
*/
function getReferenceCount($value, $includeCurrent = \true)
{
\ob_start();
\debug_zval_dump($value);
$ret = \explode("\n", \ob_get_contents());
\ob_end_clean();
if (\count($ret) >= 1 and \preg_match('/^.* refcount\\(([0-9]+)\\)\\{$/', \trim($ret[0]), $m) > 0) {
return (int) $m[1] - ($includeCurrent ? 3 : 4);
//$value + zval call + extra call
}
return -1;
}