Open GoogleCodeExporter opened 8 years ago
I had an issue with nested class, 3 level deep. The code worked with 2 level or
less. I simply changed your code to use a do while instead of a while loop to
fix the problem:
private function _check_type($type, $array, $path)
{
if (isset($this->scalar_types[strtolower($type)]))
return array(strtolower($type), '');
$apath = explode(".", $path);
do {
$namespace = join(".", $apath) . "." . $type;
foreach ($this->m_types as $message)
{
if ($message['name'] == $namespace)
{
return array($type, $namespace);
}
}
} while ( array_pop($apath ) );
$namespace = $type;
foreach ($this->m_types as $message)
{
if ($message['name'] == $namespace)
{
return array($type, $namespace);
}
}
// @TODO TYPE CHECK
throw new Exception('Protofile type ' . $type . ' unknown!');
}
Thanks for your function.
Original comment by benoit.a...@gmail.com
on 15 Sep 2010 at 3:51
Original issue reported on code.google.com by
mrst...@gmail.com
on 13 Mar 2010 at 12:08