finished multi-dimensional array support for data type debugging

This commit is contained in:
seek3r 2002-02-12 10:06:06 +00:00
parent 4c90cd3cd6
commit 86c430e66e

View File

@ -42,6 +42,25 @@
@collection_start direct functions @collection_start direct functions
@abstract Direct functions, which are not part of the API class because they are require to be availble at the lowest level. @abstract Direct functions, which are not part of the API class because they are require to be availble at the lowest level.
*/ */
/*!
@function print_debug_subarray
@abstract Not to be used directly. Should only be used by print_debug()
*/
function print_debug_subarray($array)
{
while(list($key, $value) = each($array))
{
if (is_array($value))
{
$vartypes[$key] = print_debug_subarray($value);
}
else
{
$vartypes[$key] = gettype($value);
}
}
return $vartypes;
}
/*! /*!
@function print_debug @function print_debug
@ -59,9 +78,16 @@
{ {
if (!is_array($var)) if (!is_array($var))
{ {
if ($var != 'messageonly') if ($var == 'messageonly')
{ {
echo "$message is a ".gettype($var)."<br>\n"; if (!DEBUG_DATATYPES)
{
echo "$message\n$var<br>\n";
}
else
{
echo "$message\n$var is a ".gettype($var)."<br>\n";
}
} }
else else
{ {
@ -72,9 +98,22 @@
{ {
echo "<pre>\n$message\n"; echo "<pre>\n$message\n";
print_r($var); print_r($var);
if (DEBUG_DATATYPES)
{
while(list($key, $value) = each($var)) while(list($key, $value) = each($var))
{ {
echo 'Array['.$key.'] is a '.gettype($var[$key])."\n"; //echo 'Array['.$key.'] is a '.gettype($var[$key])."\n";
if (is_array($value))
{
$vartypes[$key] = print_debug_subarray($value);
}
else
{
$vartypes[$key] = gettype($value);
}
}
echo "Data Types:\n";
print_r($vartypes);
} }
echo "\n<pre>\n"; echo "\n<pre>\n";
} }
@ -288,7 +327,7 @@
} }
if($GLOBALS['phpgw_info']['flags']['included_classes'][$classname]) if($GLOBALS['phpgw_info']['flags']['included_classes'][$classname])
{ {
if($p1 == '_UNDEF_' && $p1 != 1 && $p1 != '0') if ($p1 == '_UNDEF_' && $p1 != 1)
{ {
eval('$obj = new ' . $classname . ';'); eval('$obj = new ' . $classname . ';');
} }
@ -299,7 +338,7 @@
$code = '$obj = new ' . $classname . '('; $code = '$obj = new ' . $classname . '(';
while (list($x,$test) = each($input)) while (list($x,$test) = each($input))
{ {
if(($test == '_UNDEF_' && $test != 1 && $test != '0') || $i == 17) if (($test == '_UNDEF_' && $test != 1 ) || $i == 17)
{ {
break; break;
} }
@ -458,7 +497,7 @@
*/ */
function get_account_id($account_id = '',$default_id = '') function get_account_id($account_id = '',$default_id = '')
{ {
if (is_int($account_id)) if (gettype($account_id) == 'integer')
{ {
return $account_id; return $account_id;
} }