Created
January 20, 2023 09:25
-
-
Save joachim-n/2c3105c1fcbbb7037874cbd93c710a5c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static function check($checking_key, $data) { | |
try { | |
serialize($data); | |
} | |
catch (\Throwable $e) { | |
// The data fucked up. Go into it to see where. | |
ddm("CATCH $checking_key"); | |
if (is_array($data)) { | |
foreach ($data as $key => $val) { | |
static::check($key, $val); | |
} | |
} | |
elseif (is_object($data)) { | |
$ref = new \ReflectionObject($data); | |
foreach ($ref->getProperties() as $property) { | |
$property->setAccessible(TRUE); | |
$key = $property->getName(); | |
$val = $property->getValue($data); | |
$arg = 1; | |
static::check($key, $val); | |
} | |
} | |
else { | |
ddm("FINAL $checking_key"); | |
return; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment