Ereg Bug

From: Date: Sat, 10 Nov 2001 07:09:58 +0000
Subject: Ereg Bug
Groups: php.general 
Request: Send a blank email to php-general+get-74082@lists.php.net to get a copy of this message
I'm ready to rip my hair out! I have a form which submits to a script to generate an image using the info on the form. I am trying to center the text over the image, and this application requires the use of variable-width fonts. So I am using a very basic regex to check for an all-caps string in order to adjust the placement of the text in the image. I don't know what is causing this, but the regex seems to get "stuck" holding a particular value. If you type in a string in all lower case after changing the regex, it works fine. It may work 10 times in a row. But then after some seemingly arbitrary number of submissions, the value of the variable $uo in the script snippet below will not change. I am stumped - if anyone has any insight into this I'd appreciate it. You can view the script in action here: http://toolshed51.dhs.org/~josh/ The script prints the value of $uo preceding the input text. Thanks, Josh Code snip:
                        for($x=3;$x>=1;$x--)
                {
                        $string = ${"line" . $x};
                        $string = stripslashes($string);
                        if(ereg("^([A-Z])*$", "$string"))
                        {
                                $uo = 1;
                        } else
                        {
                                $uo = 2;
                        }


« previous php.general (#74082) next »