php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #64387 Support for a specific tag type
Submitted: 2013-03-08 10:53 UTC Modified: 2017-04-01 19:35 UTC
Votes:2
Avg. Score:3.0 ± 2.0
Reproduced:1 of 2 (50.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: therselman at gmail dot com Assigned:
Status: Wont fix Package: bbcode (PECL)
PHP Version: 5.3Git-2013-03-08 (Git) OS: ALL
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
MUST BE VALID
Solve the problem:
22 + 2 = ?
Subscribe to this entry?

 
 [2013-03-08 10:53 UTC] therselman at gmail dot com
Description:
------------
How do I support the following tag type?

[product=123]

This tag accepts an argument but has NO closing tag! I know this can be 
supported like this:

[product]123[/product]
or
[product=123][/product]

But I'm sure you will agree that it is much more verbose!

I have tried combinations of using: BBCODE_TYPE_SINGLE
with a "param_handling" and/or "content_handling" callback functions! It seems 
that BBCODE_TYPE_SINGLE ignores the callbacks as soon as you add the argument 
and leave out the closing tag, probably because BBCODE_TYPE_SINGLE doesn't 
usually expect additional parameters!

I think the fix should be simple; ie. check if there are additional 
paramenters/arguments in BBCODE_TYPE_SINGLE and run the callbacks!

Test script:
---------------
$bbcodes = array(
	'product' =>  array(
			'type'              =>  BBCODE_TYPE_SINGLE,
			'content_handling'  => 'bbcode_product'
		));

function bbcode_product($content, $argument)
{
	return '[PRODUCT]' . $content . ' : ' . $argument . '[/PRODUCT]';
}

$parser = bbcode_create($bbcodes);

echo bbcode_parse($parser, '[product=123]');


Expected result:
----------------
[PRODUCT]123 : [/PRODUCT]

Actual result:
--------------
[product=123]

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2017-04-01 19:35 UTC] tpunt@php.net
-Status: Open +Status: Wont fix
 [2017-04-01 19:35 UTC] tpunt@php.net
Due to this extension not seeing any activity since 2010, this issue will not be fixed. We are therefore closing this now.
 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Wed Aug 21 14:01:26 2019 UTC