I posted this once in response to another post and then in my investigation
I found that these validators have changed in 1.0RC3 somewhat
dramatically.We are having problems using Zend_Validate_Alpha and
Zend_Validate_Alnum but only on our production RHEL5 server. Using xampp
locally on windows XP the same code works perfectly. Prior to 1.0RC3 this
worked on production as well. We are running ZF 1.0RC3. Here is the test
code(similar to original post):
$validator = new Zend_Validate_Alnum();
$vars = array('Alnum' => 'foobar1',
'notAlnum' => '[EMAIL PROTECTED]');
foreach ($vars as $var) {
echo $validator->isValid($var) ? $var.":true\n":$var.":false\n";
}
RHEL5 response:
foobar1:false
[EMAIL PROTECTED]:false
WindowsXP response:
foobar1:true
[EMAIL PROTECTED]:false
Looking at the code both validators now leverage the filters instead of
using ctype functions. The filters use perl reg exp but even those have
changed.
For example, Zend_Validate_Alnum was:
/[^[:alnum:]]/
and now it is:
/[^\p{L}\p{N}]/u
minus the whitespace logic. I assume the whitespace logic is why this was
changed. Testing the new expression using pcretest I am receiving false for
valid strings.
RHEL5 & Windows XP
******
> pcretest
PCRE version 6.6 06-Feb-2006
re> /[^\p{L}\p{N}]/u
** Unknown option 'u'
re> /[^\p{L}\p{N}]/
data> foobar1
0: f
data> foobar
0: f
data> [EMAIL PROTECTED]
0: f
I am quite confused! Is the regular expression incorrect? It appears
correct based on my investigation but it is obviously not working. This
failed on both windowsXP and the RHEL5 server, both of which are running
pcretest 6.6. It did, however, work in my test php script on Windows XP.
The one difference here is that my PHP install on my Windows XP box has PCRE
6.7. Is this reg exp only available in PCRE 6.7?
I don't have a windows XP 6.7 pcretest at the moment, going to look to see
if cygwin has it ready for download. Once I test it I will post the
results. Below are some server details:
RHEL 5 System details:
******************************************************
PHP 5.1.6 (cli) (built: Apr 4 2007 11:38:24)
Copyright (c) 1997-2006 The PHP Group
Zend Engine v2.1.0, Copyright (c) 1998-2006 Zend Technologies
with Zend Extension Manager v1.2.0, Copyright (c) 2003-2006, by Zend
Technologies
with Zend Optimizer v3.2.6, Copyright (c) 1998-2007, by Zend
Technologies
yum info:
*******
PCRE
---------------------------------------------------------------
pcre.x86_64 6.6-1.1 installed
PHP
---------------------------------------------------------------
php.x86_64 5.1.6-11.el5 installed
php-bcmath.x86_64 5.1.6-11.el5 installed
php-cli.x86_64 5.1.6-11.el5 installed
php-common.x86_64 5.1.6-11.el5 installed
php-dba.x86_64 5.1.6-11.el5 installed
php-devel.x86_64 5.1.6-11.el5 installed
php-gd.x86_64 5.1.6-11.el5 installed
php-imap.x86_64 5.1.6-11.el5 installed
php-ldap.x86_64 5.1.6-11.el5 installed
php-mbstring.x86_64 5.1.6-11.el5 installed
php-mysql.x86_64 5.1.6-11.el5 installed
php-ncurses.x86_64 5.1.6-11.el5 installed
php-odbc.x86_64 5.1.6-11.el5 installed
php-pdo.x86_64 5.1.6-11.el5 installed
php-pear.noarch 1:1.4.9-4 installed
php-pgsql.x86_64 5.1.6-11.el5 installed
php-snmp.x86_64 5.1.6-11.el5 installed
php-soap.x86_64 5.1.6-11.el5 installed
php-xml.x86_64 5.1.6-11.el5 installed
php-xmlrpc.x86_64 5.1.6-11.el5 installed
WindowsXP System details:
**************************************************
PHP 5.2.1 (cli) (built: Feb 7 2007 23:11:26)
Copyright (c) 1997-2007 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2007 Zend Technologies
with Zend Extension Manager v1.0.11, Copyright (c) 2003-2006, by Zend
Technologies
with Zend Optimizer v3.2.2, Copyright (c) 1998-2006, by Zend
Technologies
PCRE:
*************************************************
PCRE Library Version => 6.7 04-Jul-2006
Josh