php.de

Zurück   php.de > Webentwicklung > PHP Einsteiger > PHP Tipps 2005-2

 
 
LinkBack Themen-Optionen Thema bewerten
Alt 13.07.2005, 17:45  
Erfahrener Benutzer
 
Registriert seit: 27.10.2004
Beiträge: 1.093
PHP-Kenntnisse:
Fortgeschritten
Chr!s
Standard [gelöst] Compilation failed: missing ) at offset 25 ?

Hallo,
ich sitze derzeit an einem BBCode parser. Hier erstmal der Code:
PHP-Code:
<?php
        
function replace_bbcodes($content) {
                 
$_bbcodes = array('#\[b\]#is' => '<span style="font-weight:bold">',
                                   
'#\[/b\]#is'=> '</span>',
                                   
'#\[i\]#is' => '<span style="font-style:italic">',
                                   
'#\[/i\]#is'=> '</span>',
                                   
'#\[u\]#is' => '<span style="text-decoration:underline">',
                                   
'#\[/u\]#is'=> '</span>',
                                   
'#\[img=(.+?)\]#is' => '[img]\\1[/img]',
                                   
'#\[color=(.+?)\](.+?)\[/color\]#is' => '<span style="color: \\1">\\2</span>',
                                   
'#\[url=(.+?\](.+?)\[/url\]#is' => '[url="redirect.php?url=\\1"]\\2[/url]',
                                   
'#\[size=(.+?\](.+?)\[/size\]#is' => '<span style="font-size:\\1">\\2</span>'
                                   
);
                 
$content preg_replace(array_keys($_bbcodes), array_values($_bbcodes), $content);
                 echo 
$content;
        }
}

$text '[ b]Das ist mal[ i] ein Test[ /i][ /b]
Toll oder? [ url=http://www.eye.de][ img=http://sag-ich-dir.net/pics/eye.gif][ /url]'
;
replace_bbcodes($text);
?>
(Leerzeichen absichtlich wegen dem Board eingefügt..)

Als Fehlermeldung erhalte ich:
Code:
Warning: preg_replace() [function.preg-replace]: Compilation failed: missing ) at offset 25 in ...\lib\classes\class_board.inc.php on line 19

Warning: preg_replace() [function.preg-replace]: Compilation failed: missing ) at offset 27 in ...\lib\classes\class_board.inc.php on line 19
Das, was mir der Parser zurückgibt ist:
Code:
<span style="font-weight:bold">Das ist mal<span style="font-style:italic"> ein Test</span></span>
Toll oder? [\url=http://www.eye.de][\/url]
(die \ absichtlich wegen dem BBCode dieses Boardes eingefügt)

Meine Frage nun, was ist das für ein Fehler und wie kann ich ihn beheben?
(Die Zeilenangaben stimmen nicht, da die Funktion in einer Klasse liegt. Allerdings zeigt die Zeile auf die Funktion preg_replace(...))
Chr!s ist offline  
Sponsor Mitteilung
PHP Code Flüsterer

Registriert seit: 21.08.2005
Beiträge: 4682
PHP-Kenntnisse:
Fortgeschritten

Alt 13.07.2005, 17:56  
Erfahrener Benutzer
 
Registriert seit: 27.10.2004
Beiträge: 1.093
PHP-Kenntnisse:
Fortgeschritten
Chr!s
Standard

Nach erneutem Tippen des Codes ist es mir aufgefallen:
Ich hab 2 mal die ) vergessen.. Somit wäre mein Problem gelöst
Hatte nur die Fehlermeldung wegen dem offset xx nicht verstanden..
Chr!s ist offline  
 


Themen-Optionen
Thema bewerten
Thema bewerten:

Forumregeln
Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are an
Gehe zu

Ähnliche Themen
Thema Autor Forum Antworten Letzter Beitrag
Compilation failed: lookbehind assertion is not fixed length Andreas PHP-Fortgeschrittene 8 28.12.2005 08:18
Warning: filesize(): SAFE MODE Restriction in effect. nicobischof PHP Tipps 2005-2 9 17.08.2005 19:05

Besucher kamen über folgende Suchanfragen bei Google auf diese Seite
compilation failed: missing, compilation failed: missing ), compilation failed: missing ) at offset, compilation failed, failed compilation, warning: preg_replace() [function.preg-replace]: compilation failed: missing ) at offset, preg_replace() [function.preg-replace]: compilation failed: missing, \compilation failed: missing )\, preg_replace(): compilation failed: missing ) at offset 5, php warning: preg_replace(): compilation failed, warning: preg_replace() [function.preg-replace]: compilation failed: missing ), preg_replace() [function.preg-replace]: compilation failed: missing ) at offset, compilation failed:, preg-replace compilation failed: missing ) at offset, warning: preg_match(): compilation failed: missing ) at offset 7, warning: preg_replace(): compilation failed: missing ) at offset 1, missing ) at offset, warning: preg_replace() [function.preg-replace]: compilation failed: missing, preg_replace(): compilation failed: missing ) at offset, \preg_match(): compilation failed: missing )\

Alle Zeitangaben in WEZ +2. Es ist jetzt 05:18 Uhr.




Powered by vBulletin® Version 3.7.2 (Deutsch)
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
Aprilia-Forum, Aquaristik-Forum, Liebeskummer-Forum, Zierfisch-Forum, Geizkragen-Forum

Creative Commons License
Dieser Inhalt ist unter einer Creative Commons-Lizenz lizenziert.