From:             [EMAIL PROTECTED]
Operating system: RedHat 7.1
PHP version:      4.1.1
PHP Bug Type:     Strings related
Bug description:  ereg_replace and str_replace non function

the following script fails to work with both ereg_replace and str_replace.

$sql = "select table.id, table.user, table.pass, FROM table, WHERE
table.id='1234' AND table.user='lee' AND ORDER BY table.id DESC"; 

This is being automatically generated based on the amount of arguments
passed to the script (which explains the superflous ,'s and ANDs). So, I'm
using ereg_replace to remove them like so: 

$sql = ereg_replace(', FROM', ' FROM', $sql); 
$sql = ereg_replace(', WHERE', ' WHERE', $sql); 
$sql = ereg_replace('AND ORDER', 'ORDER', $sql); 

$sql should be modified to:

select table.id, table.user, table.pass FROM table WHERE table.id='1234'
AND table.user='lee' ORDER BY table.id DESC

However, it remains unchanged. With more investigation, the problem seems
to be with any pattern that contains a space or special character.

PHP configured as follows:

 './configure' '--with-apache=../apache_1.3.22'
'--prefix=/usr/local/apache/php' '--with-mysql' '--enable-track-vars'
'--enable-ftp' '--with-curl' '--with-openssl=/usr/local/ssl' '--with-gd'
'--enable-wddx' '--with-xml' '--enable-trans-id' '--with-sablot'
'--with-ldap=/usr/local' '--enable-sysvsem' '--enable-sysvshm'
'--with-pcre' '--enable-sockets' '--with-mm=/usr/local/lib/mm'
-- 
Edit bug report at http://bugs.php.net/?id=15477&edit=1
-- 
Fixed in CVS:        http://bugs.php.net/fix.php?id=15477&r=fixedcvs
Fixed in release:    http://bugs.php.net/fix.php?id=15477&r=alreadyfixed
Need backtrace:      http://bugs.php.net/fix.php?id=15477&r=needtrace
Try newer version:   http://bugs.php.net/fix.php?id=15477&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=15477&r=support
Expected behavior:   http://bugs.php.net/fix.php?id=15477&r=notwrong
Not enough info:     http://bugs.php.net/fix.php?id=15477&r=notenoughinfo
Submitted twice:     http://bugs.php.net/fix.php?id=15477&r=submittedtwice


-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to