Bug #18172 Updated: Mysql_query function RLIKE and REGEXP

From: Date: Fri, 05 Jul 2002 14:36:58 +0000
Subject: Bug #18172 Updated: Mysql_query function RLIKE and REGEXP
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-13224@lists.php.net to get a copy of this message
ID: 18172 Updated by: r.denis@bell.ca Reported By: r.denis@bell.ca -Status: Bogus +Status: Open Bug Type: MySQL related Operating System: Freebsd/Linux PHP Version: 4.2.1 New Comment: How hard is to write the following. echo $query2; It does not take a brain to figure out that both queries are identical. I suspect that the issue might be in one of the php regex*.h files. /usr/local/include/php/ext/mbstring/mbregex.h /usr/local/include/php/main/php_regex.h /usr/local/include/php/regex /usr/local/include/php/regex/cclass.h /usr/local/include/php/regex/cname.h /usr/local/include/php/regex/regex.h /usr/local/include/php/regex/regex2.h /usr/local/include/php/regex/regex_extra.h /usr/local/include/php/regex/utils.h There is nothing wrong with the query. I do not have to addslashes ie \"$zcntlogin\"; or should not have to add % to the query variable. To further clarify the issue. The query returns records, however it does not return all of the records of the given userid zcntlogin. Userids in this context is a list of space delineated userids. Which is used to grant access to specific files. RLIKE should work however it does not. Previous Comments: ------------------------------------------------------------------------ [2002-07-05 10:18:09] sander@php.net You're very likely to be messing up with quotation and/or other special characters. Print $query2 before sending it mysql to see what you're doing wrong. Not a bug in PHP. For more, ask support on the appropriate places (see http://php.net/support for a list). ------------------------------------------------------------------------ [2002-07-05 09:57:11] r.denis@bell.ca # locate php.ini /usr/local/etc/php.ini /usr/local/etc/php.ini-dist ruoc4k# grep -i register /usr/local/etc/php.ini ; This directive describes the order in which PHP registers GET, POST, Cookie, ; Whether or not to register the EGPCS variables as global variables. You may ; register_globals to be on; Using form variables as globals can easily lead register_globals = on register_argc_argv = On ; autoregister constants of a components typlib on com_load() ;com.autoregister_typelib = true ; register constants casesensitive ;com.autoregister_casesensitive = false ;com.autoregister_verbose = true Register locals was turned on because of the way some of the data was being passed. ------------------------------------------------------------------------ [2002-07-05 03:55:10] mfischer@php.net In PHP 4.2.0, the 'register_globals' setting default changed to be off. See http://www.php.net/release_4_2_0.php for more info. We are sorry about the inconvenience, but this change was a necessary part of our efforts to make PHP scripting more secure and portable. ------------------------------------------------------------------------ [2002-07-04 23:08:50] r.denis@bell.ca I am not certain what the issue is however, When mysql_query is called in the following manner it fails to return all regexp occurances of the the given variable; Both REGEXP and RLIKE fail! $query2="select * from report WHERE users REGEXP '$zcntlogin'"; //$query2="select * from report WHERE users RLIKE '$zcntlogin'"; This is, or from my understanding should be the equivalent of connecting to the mysql server and executing the command: select * from report WHERE users RLIKE 'firstname.lastname'; //which works! In my script $zcntlogin is set through pam_smbd and mod_auth_external <?php if (!isset($PHP_AUTH_USER) || !zcntlogin) { header("WWW-Authenticate: Basic realm=\"Bell Domain\""); header("HTTP/1.0 401 Unauthorized"); echo "Text to send if user hits Cancel button\n"; exit; } else { $zcntlogin =$PHP_AUTH_USER; } ?> Hopefully that helps. Cheers, Rob ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=18172&edit=1

« previous php.bugs (#13224) next »