0
0
mirror of https://github.com/phpv8/v8js.git synced 2025-01-03 11:21:51 +00:00

Handle NULL in global.var_dump().

This commit is contained in:
C. Scott Ananian 2013-10-20 11:39:30 -04:00
parent 0e1c6ef5e9
commit c725a80674

View File

@ -57,14 +57,20 @@ V8JS_METHOD(print) /* {{{ */
static void _php_v8js_dumper(v8::Local<v8::Value> var, int level TSRMLS_DC) /* {{{ */
{
v8::String::Utf8Value str(var->ToDetailString());
const char *valstr = ToCString(str);
size_t valstr_len = (valstr) ? strlen(valstr) : 0;
if (level > 1) {
php_printf("%*c", (level - 1) * 2, ' ');
}
if (var->IsNull())
{
php_printf("NULL\n");
return;
}
v8::String::Utf8Value str(var->ToDetailString());
const char *valstr = ToCString(str);
size_t valstr_len = (valstr) ? strlen(valstr) : 0;
if (var->IsString())
{
php_printf("string(%zu) \"%s\"\n", valstr_len, valstr);