New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

method canBeSerialized implemented #3

Closed
wants to merge 4 commits into
base: master
from

Conversation

Projects
None yet
4 participants
@tael

tael commented Feb 25, 2015

implements properly!

i'm not sure about write the test-code with phpUnit,
please someone improves that.

and i have no idea for 100 over recursive calls :(

  • it means class or array have 100 over depth. (really rarely)
@tael

This comment has been minimized.

Show comment
Hide comment
@tael

tael commented Feb 25, 2015

related c217a59

@tael

This comment has been minimized.

Show comment
Hide comment
@tael

tael Feb 25, 2015

i don't know that why DOMDocument can not be serialize...
DOMDocument::loadXML(): Empty string supplied as input

tael commented Feb 25, 2015

i don't know that why DOMDocument can not be serialize...
DOMDocument::loadXML(): Empty string supplied as input

@whatthejeff

This comment has been minimized.

Show comment
Hide comment
@whatthejeff

whatthejeff Feb 25, 2015

Collaborator

@tael Internal classes and classes extending internal classes can not be considered serializable if they do not implement the Serializable interface.

Collaborator

whatthejeff commented Feb 25, 2015

@tael Internal classes and classes extending internal classes can not be considered serializable if they do not implement the Serializable interface.

@tael

This comment has been minimized.

Show comment
Hide comment
@tael

tael Feb 25, 2015

@whatthejeff
yea, i realized something is wrong :(
could you leave the link about 'Internal classes' ?
I think that I'm missing something conceptional.

tael commented Feb 25, 2015

@whatthejeff
yea, i realized something is wrong :(
could you leave the link about 'Internal classes' ?
I think that I'm missing something conceptional.

@whatthejeff

This comment has been minimized.

Show comment
Hide comment
@tael

This comment has been minimized.

Show comment
Hide comment
@tael

tael Feb 25, 2015

@whatthejeff
oh, thanks !
I did not understood your code, and try to fix something.
what a foolish..
I will try fix more. thank you!

tael commented Feb 25, 2015

@whatthejeff
oh, thanks !
I did not understood your code, and try to fix something.
what a foolish..
I will try fix more. thank you!

@tael

This comment has been minimized.

Show comment
Hide comment
@tael

tael Feb 28, 2015

can someone check this PR? with any comment to improve :-)

tael commented Feb 28, 2015

can someone check this PR? with any comment to improve :-)

}
$o = new \ReflectionObject($variable);
$properties = $o->getProperties(\ReflectionProperty::IS_STATIC | \ReflectionProperty::IS_PUBLIC | \ReflectionProperty::IS_PROTECTED);
foreach ($properties as $p) {

This comment has been minimized.

@mrclay

mrclay Oct 11, 2015

Contributor

Will this traverse dynamically added properties?

@mrclay

mrclay Oct 11, 2015

Contributor

Will this traverse dynamically added properties?

*/
private function canBeSerialized($variable)
{
if (!is_object($variable)) {

This comment has been minimized.

@mrclay

mrclay Oct 11, 2015

Contributor

Instead of truly catching circular references it might be sufficient to increment a counter in each nested canBeSerialized() call and return true once it's over, say, 50.

@mrclay

mrclay Oct 11, 2015

Contributor

Instead of truly catching circular references it might be sufficient to increment a counter in each nested canBeSerialized() call and return true once it's over, say, 50.

@sebastianbergmann

This comment has been minimized.

Show comment
Hide comment
@sebastianbergmann

sebastianbergmann Apr 27, 2017

Owner

Sorry for dropping the ball on this. In case you're still interested in this, @tael, feel free to open a new pull request that uses https://github.com/sebastianbergmann/object-enumerator for looking at all objects of an object graph. See #12.

Owner

sebastianbergmann commented Apr 27, 2017

Sorry for dropping the ball on this. In case you're still interested in this, @tael, feel free to open a new pull request that uses https://github.com/sebastianbergmann/object-enumerator for looking at all objects of an object graph. See #12.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment