PHP 4.0 Bug #10156: nl2br doesn't ad XHTML slash

From: Date: Wed, 04 Apr 2001 11:13:35 +0000
Subject: PHP 4.0 Bug #10156: nl2br doesn't ad XHTML slash
Groups: php.dev 
Request: Send a blank email to php-dev+get-50826@lists.php.net to get a copy of this message
From: kynaston@yahoo.com Operating system: Red Hat 7.0 (x86) PHP version: 4.0.4pl1 PHP Bug Type: *Function Specific Bug description: nl2br doesn't ad XHTML slash It seems that contrary to the docs, nl2br doesn't replace returns with <br/>, only with <br>. Give it a try with: print htmlspecialchars(nl2br("line1 \n line2 \n line3")); If you're looking for XHTML compliance, use: function nl2br_xhtml($text) { return str_replace("<br>", "<br />", nl2br($text)); } rgds, Matt My config command: './configure' '--prefix=/usr' '--with-config-file-path=/etc' '--disable-debug' '--enable-pic' '--enable-shared' '--enable-inline-optimization' '--with-apxs=/usr/sbin/apxs' '--with-exec-dir=/usr/bin' '--with-regex=system' '--with-gettext' '--with-gd' '--with-jpeg-dir=/usr' '--with-png' '--with-zlib' '--with-db2' '--with-db3' '--with-gdbm' '--enable-debugger' '--enable-magic-quotes' '--enable-safe-mode' '--enable-sockets' '--enable-sysvsem' '--enable-sysvshm' '--enable-track-vars' '--enable-yp' '--enable-ftp' '--enable-wddx' '--without-mysql' '--without-oracle' '--without-oci8' '--with-xml' -- Edit Bug report at: http://bugs.php.net/?id=10156&edit=1

« previous php.dev (#50826) next »