Skip to content

Instantly share code, notes, and snippets.

@joachim-n
Created January 20, 2023 09:25
Show Gist options
  • Save joachim-n/2c3105c1fcbbb7037874cbd93c710a5c to your computer and use it in GitHub Desktop.
Save joachim-n/2c3105c1fcbbb7037874cbd93c710a5c to your computer and use it in GitHub Desktop.
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