PDA

View Full Version : vsprintf Output is Blank


Zamurick X
08-27-2008, 09:37 PM
Well, I solved most of my problems with updating Andreas' Multiple Option BBCode mod (for 3.5), but I have one more problem.

Once again, I'll start with my code.

bbcode_parse_start (appears to work properly):
foreach ($this->tag_list['option'] AS $tag => $bbcode)
{
if (strpos($bbcode['html'], '{option1}'))
{
$this->tag_list['option']["$tag"]['html'] = preg_replace('/\{option(\d+)\}/e', "'%' . (intval('\\1')+1) . '\$s'", $bbcode['html']);
unset($this->tag_list['option']["$tag"]['html']);

$this->tag_list['option']["$tag"]['callback'] = 'handle_external';
$this->tag_list['option']["$tag"]['external_callback'] = 'handle_options';
}
}

bbcode_fetch_tags (has issue(s)):
if (!function_exists('handle_options'))
{
function handle_options(&$parser, $param, $options='')
{
$replace = array($param);
$replace = array_merge($param, explode(';', $options));
/*
* Below lines for debugging. *
* print_r($parser);
* print_r($options);
* print_r($replace);
* Above lines for debugging. *
*/

$return = vsprintf($parser->tag_list['option']["$parser->open[name]"]['html'], $replace);
echo $return; //Echo is blank.
//return $return; * commented for debugging purposes.
}

}

As the comments clearly state, when echoing $return, the result is blank.

I have no idea what the cause of the problem could be, I've tried changing "$parser->open[name]" to too many things to remember. No, I didn't guess at them either, I looked through the class_bbcode file and snooped in the parser array to find more possibilities as well.

In case you need to know, the replace array contains the following.
Array
(
[0] => Test.......
[1] => Zamurick
[2] => 5
)

Any ideas?


EDIT: Figured everything out.