ID:               16501
 Updated by:       [EMAIL PROTECTED]
 Reported By:      [EMAIL PROTECTED]
 Status:           Bogus
 Bug Type:         PCRE related
 Operating System: SuSE GNU/Linux 7.3
 PHP Version:      4.0.6
 New Comment:

My stupid: Windows linebreak ist \015\012, so curious things were bound
to happen.


Previous Comments:
------------------------------------------------------------------------

[2002-04-09 04:17:53] [EMAIL PROTECTED]

The bug system is not the appropriate forum for asking support
questions. For a list of a range of more appropriate places to ask
for help using PHP, please visit http://www.php.net/support.php

Hint: IIRC, PHP converts all newlines to \n so you can use \n in your
regexes.

------------------------------------------------------------------------

[2002-04-08 17:32:40] [EMAIL PROTECTED]

Preface:
Was writing a script to replace single linebreaks in input to <br/> and
multiple to </p><p class="content"> such as to parse user scribbling to
very simple xhtml. Multiplatform linebreaks should be accepted.

There, I think I encountered very strange behaviour of PHP concerning
octally escaped chars.

If I did something very very stupid, please don't hate me too much, I'm
not too experienced w/ php. I however first showed this to a friend who
is and he didn't know what it was either.

Short script:
------------------------
// parsed all newlines as single ones, resulting in a many <br/>s --
// two (!) for a linebreak, 1 for every added linebreak in the input
parseUserTextfield1($input) {
$parsed=preg_replace(array("/(\012\015|\012|\015)/","/(\012\015|\012|\015)(\012\015|\012|\015)+/"),

               array('<br/>','</p><p class="content">'),
                       $input);

  return $parsed;
}

// parsed all newlines as multi ones, resulting in a many </p><p>s --
// so, only the first one seems to be matched...almost as if one
linebreak in
// the browser seemed like multiple ones in the string
// browser is a mozilla 0.9.8 on the server -- shouldn't it just send
\012
// using a linux-based system?

parseUserTextfield2($input) {
$parsed=preg_replace(array("/(\012\015|\012|\015)(\012\015|\012|\015)+/","/(\012\015|\012|\015)/"),

                       array('</p><p class="content">','<br/>'),
                       $input);

  return $parsed;
}

// curious thing: if i replace the linebreak expr. w/ BREAK as in:
function parseUserTextfield($input) {
  $parsed=preg_replace(array("/(BREAK)(BREAK)+/","/(BREAK)/"),
                       array('</p><p class="content">','<br/>'),
                       $parsed);

  return $parsed;
}
// everything works as expected
------------------------

List of Modules // ./configure - line (this simply is the SuSE7.3 i386
Cfg with security updates):

'./configure' '--prefix=/usr/share' '--datadir=/usr/share/php'
'--bindir=/usr/bin' '--libdir=/usr/share'
'--with-config-file-path=/etc' '--with-exec-dir=/usr/lib/php/bin'
'--with-mysql=/usr' '--with-gd=yes' '--enable-gd-native-ttf'
'--enable-gd-imgstrttf' '--with-tiff-dir=/usr' '--with-jpeg-dir=/usr'
'--with-png-dir=/usr' '--with-xpm-dir=/usr/X11R6' '--with-ldap=yes'
'--with-zlib=yes' '--with-bz2' '--with-gmp' '--with-xml' '--with-dom'
'--with-ttf' '--with-t1lib' '--with-mcal=/usr' '--with-imap=yes'
'--with-sablot' '--with-readline' '--with-ftp' '--with-ndbm'
'--with-gdbm' '--with-mcrypt' '--with-gettext' '--with-mm'
'--with-gd=yes' '--with-qtdom=/usr/lib/qt' '--enable-versioning'
'--enable-yp' '--enable-bcmath' '--enable-trans-sid'
'--enable-inline-optimization' '--enable-track-vars'
'--enable-magic-quotes' '--enable-safe-mode' '--enable-sockets'
'--enable-sysvsem' '--enable-sysvshm' '--enable-shmop'
'--enable-calendar' '--enable-mbstring' '--enable-mbstr-enc-trans'
'--enable-exif' '--enable-ftp' '--enable-memory-limit' '--enable-wddx'
'--enable-filepro' '--enable-dbase' '--enable-ctype' '--disable-debug'
'--enable-force-cgi-redirect' '--enable-discard-path'
'--enable-sigchild' '--with-openssl' '--with-curl' '--with-swf=./dist/'
'--with-imap-ssl' '--with-gd=yes' '--with-apxs=/usr/sbin/apxs'
'--with-pgsql=/usr' '--with-snmp' 'i386-suse-linux'

Other Info:
None that I know of.

Backtrace:
No crash, no trace.


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=16501&edit=1

Reply via email to