$limit = strlen( $text )-1;
$output = array();
}
- if( '{}' != $text )
+ if( '{}' == $text ) {
+ return $output;
+ }
do {
if ( '{' != $text{$offset} ) {
preg_match( "/(\\{?\"([^\"\\\\]|\\\\.)*\"|[^,{}]+)+([,}]+)/",
$output[] = ( '"' != $match[1]{0}
? $match[1]
: stripcslashes( substr( $match[1], 1, -1 ) ) );
- if ( '},' == $match[3] )
+ if ( '},' == $match[3] ) {
return $output;
- } else
- $offset = $this->pg_array_parse( $text, $output[], $limit, $offset+1 );
+ }
+ } else {
+ $offset = $this->pg_array_parse( $text, $output, $limit, $offset+1 );
+ }
} while ( $limit > $offset );
return $output;
}