I have run into a problem running PHP code using preg_match_all.
I'm racking my brain trying to figure out a solution. Maybe someone
else knows the answer?
I have two boxes that I'm working on, and I've moved some PHP code from
one box using PHP version 4.2.2 (Intel running Red Hat) to another using PHP
version 4.3.4 (z890 running SuSE S390x). The code is as follows:
<?php
$lc = "A-Za-z_'0-9\x80-\xFF\-";
$filteredText = "First Next Last";
if(preg_match_all('/([-+<>~]?)(([' . $lc . ']+)(\*?)|"[^"]*")/',
$filteredText,$m,PREG_SET_ORDER))
{
foreach($m as $terms)
{
print("terms[1-3] = [${terms[1]}, ${terms[2]},
{terms[3]}]<br/>");
}
}
else
print("Error: no match or nothing in filteredText.");
?>
On the 4.2.2 box the output is:
terms[1-3] = [, First, First]
terms[1-3] = [, Next, Next]
terms[1-3] = [, Last, Last]
On the 4.3.4 box the output is:
terms[1-3] = [Next, Last, ]
terms[1-3] = [, , ]
terms[1-3] = [Next, Last, ]
terms[1-3] = [Next, Last, ]
terms[1-3] = [, , ]
For additional information, I have the server info. listed below.
PHP 4.2.2 box:
-Linux 7njvv01a.bco-home.com 2.4.20-6 #1 Thu Feb 27 10:06:59 EST 2003
i686
-Configure Command:
'./configure'
'--host=i386-redhat-linux'
'--build=i386-redhat-linux'
'--target=i386-redhat-linux-gnu'
'--program-prefix='
'--prefix=/usr'
'--exec-prefix=/usr'
'--bindir=/usr/bin'
'--sbindir=/usr/sbin'
'--sysconfdir=/etc'
'--datadir=/usr/share'
'--includedir=/usr/include'
'--libdir=/usr/lib'
'--libexecdir=/usr/libexec'
'--localstatedir=/var'
'--sharedstatedir=/usr/com'
'--mandir=/usr/share/man'
'--infodir=/usr/share/info'
'--cache-file=../config.cache'
'--with-config-file-path=/etc'
'--with-config-file-scan-dir=/etc/php.d'
'--enable-force-cgi-redirect'
'--disable-debug'
'--enable-pic'
'--disable-rpath'
'--enable-inline-optimization'
'--with-bz2'
'--with-db3'
'--with-curl'
'--with-dom=/usr'
'--with-exec-dir=/usr/bin'
'--with-freetype-dir=/usr'
'--with-png-dir=/usr'
'--with-gd'
'--enable-gd-native-ttf'
'--with-ttf'
'--with-gdbm'
'--with-gettext'
'--with-ncurses'
'--with-gmp'
'--with-iconv'
'--with-jpeg-dir=/usr'
'--with-openssl'
'--with-png'
'--with-pspell'
'--with-regex=system'
'--with-xml'
'--with-expat-dir=/usr'
'--with-zlib'
'--with-layout=GNU'
'--enable-bcmath'
'--enable-exif'
'--enable-ftp'
'--enable-magic-quotes'
'--enable-safe-mode'
'--enable-sockets'
'--enable-sysvsem'
'--enable-sysvshm'
'--enable-discard-path'
'--enable-track-vars'
'--enable-trans-sid'
'--enable-yp'
'--enable-wddx'
'--without-oci8'
'--with-pear=/usr/share/pear'
'--with-imap=shared'
'--with-imap-ssl'
'--with-kerberos=/usr/kerberos'
'--with-ldap=shared'
'--with-mysql=shared,/usr'
'--with-pgsql=shared'
'--with-snmp=shared,/usr'
'--with-snmp=shared'
'--enable-ucd-snmp-hack'
'--with-unixODBC=shared'
'--enable-memory-limit'
'--enable-bcmath'
'--enable-shmop'
'--enable-versioning'
'--enable-calendar'
'--enable-dbx'
'--enable-dio'
'--enable-mcal'
'--with-apxs2=/usr/sbin/apxs'
PHP 4.3.4 box:
-Linux techlnux 2.6.5-7.155.29-s390x #1 SMP Thu Jun 2 12:07:05 UTC 2005
s390x
s390x s390x GNU/Linux
-Configure Command:
'./configure'
'--prefix=/usr'
'--datadir=/usr/share/php'
'--mandir=/usr/share/man'
'--bindir=/usr/bin'
'--libdir=/usr/share'
'--includedir=/usr/include'
'--sysconfdir=/etc'
'--with-_lib=lib64'
'--with-config-file-path=/etc'
'--with-exec-dir=/usr/lib64/php/bin'
'--disable-debug'
'--enable-inline-optimization'
'--enable-memory-limit'
'--enable-magic-quotes'
'--enable-safe-mode'
'--enable-sigchild'
'--disable-ctype'
'--disable-session'
'--without-mysql'
'--disable-cli'
'--without-pear'
'--with-openssl'
'--with-apxs2=/usr/sbin/apxs2-prefork'
's390x-suse-linux'
The 4.2.2 box is actually the one that is giving me the correct data
back. Is there something that I have to change in the configuration
that relates to preg_match_all?
Any help would be greatly appreciated.
Thanks for any and all comments/suggestions.
----------------------------------------------------------------------
For LINUX-390 subscribe / signoff / archive access instructions,
send email to [EMAIL PROTECTED] with the message: INFO LINUX-390 or visit
http://www.marist.edu/htbin/wlvindex?LINUX-390