Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
doctrine-dbal
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Tomáš Trávníček
doctrine-dbal
Commits
cce97067
Commit
cce97067
authored
Mar 20, 2010
by
guilhermeblanco
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[2.0][DDC-404] Fixed issue that was failing to debug Proxies and DateTime objects
parent
9d2c2756
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
14 deletions
+34
-14
Debug.php
lib/Doctrine/Common/Util/Debug.php
+34
-14
No files found.
lib/Doctrine/Common/Util/Debug.php
View file @
cce97067
...
@@ -59,7 +59,7 @@ final class Debug
...
@@ -59,7 +59,7 @@ final class Debug
ini_set
(
'xdebug.var_display_max_depth'
,
$maxDepth
);
ini_set
(
'xdebug.var_display_max_depth'
,
$maxDepth
);
}
}
$var
=
self
::
_dumpWithReflection
(
$var
,
$maxDepth
++
);
$var
=
self
::
export
(
$var
,
$maxDepth
++
);
ob_start
();
ob_start
();
var_dump
(
$var
);
var_dump
(
$var
);
...
@@ -71,7 +71,7 @@ final class Debug
...
@@ -71,7 +71,7 @@ final class Debug
ini_set
(
'html_errors'
,
'Off'
);
ini_set
(
'html_errors'
,
'Off'
);
}
}
p
rivate
static
function
_dumpWithReflection
(
$var
,
$maxDepth
)
p
ublic
static
function
export
(
$var
,
$maxDepth
)
{
{
$return
=
null
;
$return
=
null
;
$isObj
=
is_object
(
$var
);
$isObj
=
is_object
(
$var
);
...
@@ -85,20 +85,40 @@ final class Debug
...
@@ -85,20 +85,40 @@ final class Debug
$return
=
array
();
$return
=
array
();
foreach
(
$var
as
$k
=>
$v
)
{
foreach
(
$var
as
$k
=>
$v
)
{
$return
[
$k
]
=
self
::
_dumpWithReflection
(
$v
,
$maxDepth
-
1
);
$return
[
$k
]
=
self
::
export
(
$v
,
$maxDepth
-
1
);
}
}
}
else
if
(
$isObj
)
{
}
else
if
(
$isObj
)
{
if
(
$var
instanceof
\DateTime
)
{
$return
=
$var
->
format
(
'c'
);
}
else
{
$reflClass
=
new
\ReflectionClass
(
get_class
(
$var
));
$reflClass
=
new
\ReflectionClass
(
get_class
(
$var
));
$return
=
new
\stdclass
();
$return
=
new
\stdclass
();
$return
->
{
'__CLASS__'
}
=
get_class
(
$var
);
$return
->
{
'__CLASS__'
}
=
get_class
(
$var
);
foreach
(
$reflClass
->
getProperties
()
as
$reflProperty
)
{
if
(
$var
instanceof
\Doctrine\ORM\Proxy\Proxy
&&
!
$var
->
__isInitialized__
)
{
$reflProperty
=
$reflClass
->
getProperty
(
'_identifier'
);
$reflProperty
->
setAccessible
(
true
);
$reflProperty
->
setAccessible
(
true
);
foreach
(
$reflProperty
->
getValue
(
$var
)
as
$name
=>
$value
)
{
$return
->
$name
=
self
::
export
(
$value
,
$maxDepth
-
1
);
}
}
else
{
$excludeProperties
=
array
();
if
(
$var
instanceof
\Doctrine\ORM\Proxy\Proxy
)
{
$excludeProperties
=
array
(
'_entityPersister'
,
'__isInitialized__'
,
'_identifier'
);
}
foreach
(
$reflClass
->
getProperties
()
as
$reflProperty
)
{
$name
=
$reflProperty
->
getName
();
$name
=
$reflProperty
->
getName
();
$value
=
$reflProperty
->
getValue
(
$var
);
$return
->
$name
=
self
::
_dumpWithReflection
(
$value
,
$maxDepth
-
1
);
if
(
!
in_array
(
$name
,
$excludeProperties
))
{
$reflProperty
->
setAccessible
(
true
);
$return
->
$name
=
self
::
export
(
$reflProperty
->
getValue
(
$var
),
$maxDepth
-
1
);
}
}
}
}
}
}
else
{
}
else
{
$return
=
$var
;
$return
=
$var
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment