@@ -271,8 +271,13 @@ protected function parseBBCode($bbcode):string{
271
271
protected function parseAttributes (string $ attributes ):array {
272
272
$ attr = [];
273
273
274
+ if (empty ($ attributes )){
275
+ return $ attr ;
276
+ }
277
+
274
278
// @todo: fix attributes pattern: accept single and double quotes around the value
275
- if (preg_match_all ('#(?<name>^|\w+)\=( \'?)(?<value>[^ \']*?)2円(?: |$)# ' , $ attributes , $ matches , PREG_SET_ORDER ) > 0 ){
279
+ if (preg_match_all ('#(?<name>^|[[a-z]+)\=([" \']?)(?<value>[^" \']*?)2円(?: |$)#i ' , $ attributes , $ matches , PREG_SET_ORDER ) > 0 ){
280
+ print_r (['$attributes ' => $ attributes , '$matches ' => $ matches ]);
276
281
277
282
foreach ($ matches as $ attribute ){
278
283
$ name = empty ($ attribute ['name ' ]) ? $ this ->options ->placeholder_bbtag : strtolower (trim ($ attribute ['name ' ]));
@@ -285,6 +290,7 @@ protected function parseAttributes(string $attributes):array{
285
290
286
291
if ($ e !== PREG_NO_ERROR ){
287
292
$ this ->logger ->debug ('preg_error ' , ['errno ' => $ e , '$attributes ' => $ attributes ]);
293
+ $ attr ['__error__ ' ] = $ attributes ;
288
294
}
289
295
290
296
return $ attr ;
0 commit comments