php-general Digest 5 May 2011 21:55:09 -0000 Issue 7299

Topics (messages 312674 through 312692):

Re: Installing on a Mac: include_path issues
        312674 by: Mike Mackintosh
        312677 by: Ken Kixmoeller
        312678 by: Ken Kixmoeller
        312679 by: Ken Kixmoeller
        312681 by: Mike Mackintosh
        312688 by: Ken Kixmoeller

Re: Closing Session (Revisited)
        312675 by: Roger Riordan
        312676 by: Steve Staples

Re: filter_var using regex
        312680 by: Jason Gerfen
        312689 by: Jason Gerfen
        312691 by: Ashley Sheridan

mysql error
        312682 by: Grega Leskovšek
        312683 by: Andre Polykanine
        312684 by: Daniel Brown

iPhone apology - was Re: [PHP] Re: Installing on a Mac: include_path issues
        312685 by: Richard Quadling
        312686 by: Ken Kixmoeller
        312687 by: Jason Pruim
        312690 by: Richard Quadling

PHP 5.2.17 zend_mm_panic Called
        312692 by: Bruce Bailey

Administrivia:

To subscribe to the digest, e-mail:
        [email protected]

To unsubscribe from the digest, e-mail:
        [email protected]

To post to the list, e-mail:
        [email protected]


----------------------------------------------------------------------
--- Begin Message ---
Run phpinfo() or php -I and see if the PHP.ini file is being loaded.

Sent from my iPhone

On May 5, 2011, at 5:40, Richard Quadling <[email protected]> wrote:

> On 5 May 2011 05:51, David Robley <[email protected]> wrote:
>> Ken Kixmoeller wrote:
>> 
>>> Hey, folks -- --
>>> 
>>> I am switching over my development (I hope) to a Mac. Having some
>>> trouble with the configuration. Rudimentary scripts run fine in the
>>> document_root, but beyond that, my scripts in the include_path are not
>>> found.
>>> 
>>> The include_path has a couple of directories in which I have my
>>> foundation classes and a clients application classes and other
>>> programs. For various reasons, I put them into my "Documents/Clients"
>>> folder. When I create to set the path to these files in PHP, they are:
>>> 
>>>  /Users/ken/Documents/Clients/comped_php
>>>  /Users/ken/Documents/Clients/jaguar_php
>>> 
>>> PHP doesn't find them, which has me stumped.
>>> 
>>> php.ini shows the include_path correctly, as:
>>>   
>>> /Users/ken/Documents/Clients/comped_php:/Users/ken/Documents/Clients/jaguar_php
>>> 
>>> the document_root, configured in Apache is: /Users/ken/Sites/
>>> 
>>> The errors show as:
>>> include_once() [function.include]: Failed opening 'smm_header.php' for
>>> inclusion
>>> 
>> (include_path='/Users/ken/Documents/Clients/comped_php:/Users/ken/Documents/Clients/jaguar_php')
>>> in /Users/ken/Sites/smm_registration/smmcomputereducation.php on line 1
>>> 
>>> Any ideas or suggestions?
>>> 
>>> Thanks,
>>> 
>>> Ken
>> 
>> If I remember correctly, include and friends have two parts to the error
>> message but you've only shown us one. For a guess, is it possible the
>> apache process doesn't have permissions for those directories and/or the
>> files within them?
>> 
>> 
>> 
>> Cheers
>> --
>> David Robley
>> 
>> I've got Parkinson's disease. And he's got mine.
>> Today is Setting Orange, the 52nd day of Discord in the YOLD 3177.
>> 
>> 
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>> 
>> 
> 
> include_path should only contain directories, not filenames. [1]
> 
> Richard.
> 
> [1] http://docs.php.net/manual/en/ini.core.php#ini.include-path
> 
> -- 
> Richard Quadling
> Twitter : EE : Zend
> @RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 

--- End Message ---
--- Begin Message ---
On Thu, May 5, 2011 at 4:40 AM, Richard Quadling <[email protected]> wrote:
> On 5 May 2011 05:51, David Robley <[email protected]> wrote:
>> Ken Kixmoeller wrote:
>>
> include_path should only contain directories, not filenames. [1]

Thanks. Yes, both of those are directories.

Ken

--- End Message ---
--- Begin Message ---
On Wed, May 4, 2011 at 11:51 PM, David Robley <[email protected]> wrote:
>> php.ini shows the include_path correctly, as:
> If I remember correctly, include and friends have two parts to the error
> message but you've only shown us one. For a guess, is it possible the
> apache process doesn't have permissions for those directories and/or the
> files within them?

Yes, it ia  two-parter. I showed the second. The first is:

Warning: include_once(smm_header.php) [function.include-once]: failed
to open stream: No such file or directory in
/Users/ken/Sites/smm_registration/smmcomputereducation.php on line 1

I am checking out the "rights" issue --- sounds like a great lead. Thank you.

Ken

--- End Message ---
--- Begin Message ---
On Thu, May 5, 2011 at 5:59 AM, Mike Mackintosh
<[email protected]> wrote:
> Run phpinfo() or php -I and see if the PHP.ini file is being loaded.

>>>> php.ini shows the include_path correctly, as:
>>>>   
>>>> /Users/ken/Documents/Clients/comped_php:/Users/ken/Documents/Clients/jaguar_php

Oops, that line was supposed to say "phpinfo() shows the include_path
correctly." Sorry for the confusion. phpinfo() runs just fine and
shows me what I expected.

Ken

--- End Message ---
--- Begin Message ---
What are the permissions on the include directory?

Sent from my iPhone

On May 5, 2011, at 9:42, Ken Kixmoeller <[email protected]> wrote:

> On Thu, May 5, 2011 at 5:59 AM, Mike Mackintosh
> <[email protected]> wrote:
>> Run phpinfo() or php -I and see if the PHP.ini file is being loaded.
> 
>>>>> php.ini shows the include_path correctly, as:
>>>>>   
>>>>> /Users/ken/Documents/Clients/comped_php:/Users/ken/Documents/Clients/jaguar_php
> 
> Oops, that line was supposed to say "phpinfo() shows the include_path
> correctly." Sorry for the confusion. phpinfo() runs just fine and
> shows me what I expected.
> 
> Ken
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 

--- End Message ---
--- Begin Message ---
On Thu, May 5, 2011 at 9:08 AM, Mike Mackintosh
<[email protected]> wrote:
> What are the permissions on the include directory?
> --

Well, I swear that I had set the permissions to r/w for these
directories, but after I did it (again?), now I get a whole *new* set
of errors which seem to be about connecting to MySQL.

So, pending further investigation, it seems like *this* problem is solved.

Many, many thanks to all who responded.

Ken

--- End Message ---
--- Begin Message ---
On Thu, 31 Mar 2011 16:40:06 -0400, [email protected] (Ethan Rosenberg) 
wrote:
...
>> > >     Can you rephrase the question, Ethan, or give more details?  From
>> > >the way it sounds, you're concerned that destroying a session will
>> > >have implications for other sessions as well, which is not the case
>> > >(unless all sessions are shared).  For example, if you have Chrome,
>> > >Firefox, and Internet Exploder all active, the sessions should be
>> > >different, if even from the very same computer.  However, multiple
>> > >tabs in the same browser will generally be the same session (unless
>> > >it's something like Chrome's Incognito feature).
...

I have developed a common engine which I use for several different websites. I 
had been
using PHP 5.2.? and IE6 (yes; I know!), and had been able to have multiple 
sessions open
at once, displaying the same or different websites, without them interfering 
with each
other. This was incredibly useful; I could be looking at, or even edit, 
different parts of
the same, or different, websites simultaneously without any problems.

But I recently had a hard disk crash and had to re-install all the system 
software. Now I
have PHP 5.3 and IE 8, and find that if I try to do this the various sessions 
interfere
with each other. From the above comment I gather that this is because IE 8 
combines all
the instances, whereas previously each instance was treated as a different user.

Is there any simple way to make IE 8 treat each instance as a new user, or 
should I switch
to Chrome and use the Incognito feature?

Roger Riordan AM
http://www.corybas.com/

--- End Message ---
--- Begin Message ---
On Thu, 2011-05-05 at 21:41 +1000, Roger Riordan wrote:
> On Thu, 31 Mar 2011 16:40:06 -0400, [email protected] (Ethan Rosenberg) 
> wrote:
> ...
> >> > >     Can you rephrase the question, Ethan, or give more details?  From
> >> > >the way it sounds, you're concerned that destroying a session will
> >> > >have implications for other sessions as well, which is not the case
> >> > >(unless all sessions are shared).  For example, if you have Chrome,
> >> > >Firefox, and Internet Exploder all active, the sessions should be
> >> > >different, if even from the very same computer.  However, multiple
> >> > >tabs in the same browser will generally be the same session (unless
> >> > >it's something like Chrome's Incognito feature).
> ...
> 
> I have developed a common engine which I use for several different websites. 
> I had been
> using PHP 5.2.? and IE6 (yes; I know!), and had been able to have multiple 
> sessions open
> at once, displaying the same or different websites, without them interfering 
> with each
> other. This was incredibly useful; I could be looking at, or even edit, 
> different parts of
> the same, or different, websites simultaneously without any problems.
> 
> But I recently had a hard disk crash and had to re-install all the system 
> software. Now I
> have PHP 5.3 and IE 8, and find that if I try to do this the various sessions 
> interfere
> with each other. From the above comment I gather that this is because IE 8 
> combines all
> the instances, whereas previously each instance was treated as a different 
> user.
> 
> Is there any simple way to make IE 8 treat each instance as a new user, or 
> should I switch
> to Chrome and use the Incognito feature?
> 
> Roger Riordan AM
> http://www.corybas.com/
> 

The Incognito feature wont give you the results you're looking for.
>From my experience, the incognito window(s) and tab(s) share the same
memory/cookie/session space, which is different from the main window...
which means you will run into the same issue.

Once you close all your incognito windows/tabs, you will release those
cookies/sessions/memory space and if you open a new one afterwards, then
you will be fine, but if one tabs stays open, no go :(

Have you looked at the http://ca3.php.net/session_name function, and
putting that into your site just after your session_start() ?  I believe
that will fix your issues (as long as your session names are unique),
but i am not 100% sure.

Steve



--- End Message ---
--- Begin Message ---
On 05/04/2011 03:10 PM, Ashley Sheridan wrote:
> On Wed, 2011-05-04 at 13:46 -0600, Jason Gerfen wrote:
> 
>> On 05/04/2011 01:27 PM, Ashley Sheridan wrote:
>>> On Wed, 2011-05-04 at 13:20 -0600, Jason Gerfen wrote:
>>>
>>>> I am running into a problem using the REGEXP option with filter_var().
>>>>
>>>> The string I am using: 09VolunteerApplication.doc
>>>> The PCRE regex I am using:
>>>> /^[a-z0-9]\.[doc|pdf|txt|jpg|jpeg|png|docx|csv|xls]{1,4}$/Di
>>>>
>>>> The function in it's entirety:
>>>> return (!filter_var('09VolunteerApplication.doc',
>>>> FILTER_VALIDATE_REGEXP,
>>>> array('options'=>array('regexp'=>'/^[a-z0-9]\.[doc|pdf|txt|jpg|jpeg|png|docx|csv|xls]{1,4}$/Di'))))
>>>> ? false : true;
>>>>
>>>> Anyone have any insight into this?
>>>>
>>>
>>>
>>> You missed a + in your regex, at the moment you're only checking to see
>>> if a file starts with a single a-z or number and then is followed by the
>>> period. Then you're checking for oddly for one to four extensions in the
>>> list, are you sure you want to do that? And the square brackets are used
>>> to match characters, not strings, use the standard brackets to allow
>>> from a choice of strings
>>>
>>> Try this:
>>>
>>> '/^[a-z0-9]+\.(doc|pdf|txt|jpg|jpeg|png|docx|csv|xls)$/Di'
>>>
>>> One other thing you should be aware of maybe, filenames won't always
>>> consist of just the letters a-z and numbers 0-9, they may contain
>>> accented or foreign letters, hyphens, spaces and a number of other
>>> characters depending on the client machines OS. Windows allows very few
>>> characters for example compared to the Unix-like OS's like MacOS and
>>> Linux.
>>>
>>
>> Both are valid PCRE regex's. However the rules regarding usage of
>> parenthesis for an XOR string does not explain a similar regex being
>> used with the filter_var() like so:
>>
>> return (filter_var('kc-1', FILTER_VALIDATE_REGEXP,
>> array('options'=>array('regexp'=>'/^[kc\-1|kc\-color|gr\-1|fa\-1|un\-1|un\-color|ben\-1|bencolor|sage\-1|sr\-1|st\-1]{1,8}$/Di')))
>> ? true : false;
>>
>> The above returns string(4) "kc-1"
>>
>> Another test using the following works similarly:
>>
>> return (filter_var('u0368839', FILTER_VALIDATE_REGEXP,
>> array('options'=>array('regexp'=>'/^[gp|u|gx]{1,2}[\d+]{6,15}$/Di'))) ?
>> true : false;
>>
>> The above returns string(8) "u0368839"
>>
>> And
>> return (filter_var('u0368839', FILTER_VALIDATE_REGEXP,
>> array('options'=>array('regexp'=>'/^[gp|u|gx]{1,2}[\d+]{6,15}$/Di'))) ?
>> true : false;
>>
>> returns string(8) "gp123456"
>>
>> As you can see these three examples use the start [] as XOR conditionals
>> for multiple strings as prefixes.
>>
>>
>>
> 
> 
> Not quite, you think they match correctly because that's all you're
> testing for, and you're not looking for anything that might disprove
> that. Using your last example, it will also match these strings:
> 
> gu0368839
> xx0368839
> p0368839
> 
> 
> I tested your first regex with '09VolunteerApplication.doc' and it
> doesn't work at all until you add in that plus after the basename match
> part of the regex:
> 
> ^[a-z0-9]+\.[doc|pdf|txt|jpg|jpeg|png|docx|csv|xls]{1,4}$
> 
> However, your regex (with the plus) also matches these strings:
> 
> 09VolunteerApplication.docp
> 09VolunteerApplication.docj
> 09VolunteerApplication.doc|    <-- note it's matching the literal bar
> character
> 
> Making the changes I suggested (^[a-z0-9]+\.(doc|pdf|txt|jpg|jpeg|png|
> docx|csv|xls)$) means the regex works as you expect. Square brackets in
> a regex match a range, not a literal string, and without any sort of
> modifier, match only a single instance of that range. So in your
> example, you're matching a 4 character extension containing any of the
> following characters '|cdfgjlnopstx', and a basename containing only 1
> character that is either an a-z or a number.
> 

You are right, after a few other tests I stand corrected. My apologies.
However according to the documentation for filter_var() and the PCRE
regexp option if it returns false, which it is, this is indicating an
error with the regex.

Here are the changes I have made:
print_r(var_dump(filter_var('09VolunteerApplication.doc',
FILTER_VALIDATE_REGEXP,
array('options'=>array('regexp'=>'/^[a-z0-9]+\.(doc|pdf|txt|jpg|jpeg|png|docx|csv|xls){1,4}$/Di')))));

I appreciate your assistance and insights.

--- End Message ---
--- Begin Message ---
On 05/04/2011 03:10 PM, Ashley Sheridan wrote:
> On Wed, 2011-05-04 at 13:46 -0600, Jason Gerfen wrote:
> 
>> On 05/04/2011 01:27 PM, Ashley Sheridan wrote:
>>> On Wed, 2011-05-04 at 13:20 -0600, Jason Gerfen wrote:
>>>
>>>> I am running into a problem using the REGEXP option with filter_var().
>>>>
>>>> The string I am using: 09VolunteerApplication.doc
>>>> The PCRE regex I am using:
>>>> /^[a-z0-9]\.[doc|pdf|txt|jpg|jpeg|png|docx|csv|xls]{1,4}$/Di
>>>>
>>>> The function in it's entirety:
>>>> return (!filter_var('09VolunteerApplication.doc',
>>>> FILTER_VALIDATE_REGEXP,
>>>> array('options'=>array('regexp'=>'/^[a-z0-9]\.[doc|pdf|txt|jpg|jpeg|png|docx|csv|xls]{1,4}$/Di'))))
>>>> ? false : true;
>>>>
>>>> Anyone have any insight into this?
>>>>
>>>
>>>
>>> You missed a + in your regex, at the moment you're only checking to see
>>> if a file starts with a single a-z or number and then is followed by the
>>> period. Then you're checking for oddly for one to four extensions in the
>>> list, are you sure you want to do that? And the square brackets are used
>>> to match characters, not strings, use the standard brackets to allow
>>> from a choice of strings
>>>
>>> Try this:
>>>
>>> '/^[a-z0-9]+\.(doc|pdf|txt|jpg|jpeg|png|docx|csv|xls)$/Di'
>>>
>>> One other thing you should be aware of maybe, filenames won't always
>>> consist of just the letters a-z and numbers 0-9, they may contain
>>> accented or foreign letters, hyphens, spaces and a number of other
>>> characters depending on the client machines OS. Windows allows very few
>>> characters for example compared to the Unix-like OS's like MacOS and
>>> Linux.
>>>
>>
>> Both are valid PCRE regex's. However the rules regarding usage of
>> parenthesis for an XOR string does not explain a similar regex being
>> used with the filter_var() like so:
>>
>> return (filter_var('kc-1', FILTER_VALIDATE_REGEXP,
>> array('options'=>array('regexp'=>'/^[kc\-1|kc\-color|gr\-1|fa\-1|un\-1|un\-color|ben\-1|bencolor|sage\-1|sr\-1|st\-1]{1,8}$/Di')))
>> ? true : false;
>>
>> The above returns string(4) "kc-1"
>>
>> Another test using the following works similarly:
>>
>> return (filter_var('u0368839', FILTER_VALIDATE_REGEXP,
>> array('options'=>array('regexp'=>'/^[gp|u|gx]{1,2}[\d+]{6,15}$/Di'))) ?
>> true : false;
>>
>> The above returns string(8) "u0368839"
>>
>> And
>> return (filter_var('u0368839', FILTER_VALIDATE_REGEXP,
>> array('options'=>array('regexp'=>'/^[gp|u|gx]{1,2}[\d+]{6,15}$/Di'))) ?
>> true : false;
>>
>> returns string(8) "gp123456"
>>
>> As you can see these three examples use the start [] as XOR conditionals
>> for multiple strings as prefixes.
>>
>>
>>
> 
> 
> Not quite, you think they match correctly because that's all you're
> testing for, and you're not looking for anything that might disprove
> that. Using your last example, it will also match these strings:
> 
> gu0368839
> xx0368839
> p0368839
> 
> 
> I tested your first regex with '09VolunteerApplication.doc' and it
> doesn't work at all until you add in that plus after the basename match
> part of the regex:
> 
> ^[a-z0-9]+\.[doc|pdf|txt|jpg|jpeg|png|docx|csv|xls]{1,4}$
> 
> However, your regex (with the plus) also matches these strings:
> 
> 09VolunteerApplication.docp
> 09VolunteerApplication.docj
> 09VolunteerApplication.doc|    <-- note it's matching the literal bar
> character
> 
> Making the changes I suggested (^[a-z0-9]+\.(doc|pdf|txt|jpg|jpeg|png|
> docx|csv|xls)$) means the regex works as you expect. Square brackets in
> a regex match a range, not a literal string, and without any sort of
> modifier, match only a single instance of that range. So in your
> example, you're matching a 4 character extension containing any of the
> following characters '|cdfgjlnopstx', and a basename containing only 1
> character that is either an a-z or a number.
> 

You are right, after a few other tests I stand corrected. My apologies.
However according to the documentation for filter_var() and the PCRE
regexp option if it returns false, which it is, this is indicating an
error with the regex.

In addition to this I would like to point out that the same regex using
the older preg_match() function works as it should while the character
class following by the pattern (+) fails the validation portion of the
regex.

print_r(var_dump(filter_var('09VolunteerApplication.doc',
FILTER_VALIDATE_REGEXP,
array('options'=>array('regexp'=>'/^[a-z0-9]+\.(doc|pdf|txt|jpg|jpeg|png|docx|csv|xls){1,4}$/Di')))));

returns false (invalid regex) when using the character matching class
[a-z0-9]+ with the filter_var() function with the FILTER_VALIDATE_REGEXP
option

print_r(var_dump(preg_match('/^[a-z0-9]+\.(doc|pdf|txt|jpg|jpeg|png|docx|csv|xls){1,4}$/i',
'09VolunteerApplication.doc')));

return int(1) indicating a valid regex as well as a valid match.

I believe this should be reported as a bug but I appreciate your
assistance and insights.


--- End Message ---
--- Begin Message ---
On Thu, 2011-05-05 at 13:39 -0600, Jason Gerfen wrote:

> On 05/04/2011 03:10 PM, Ashley Sheridan wrote:
> > On Wed, 2011-05-04 at 13:46 -0600, Jason Gerfen wrote:
> > 
> >> On 05/04/2011 01:27 PM, Ashley Sheridan wrote:
> >>> On Wed, 2011-05-04 at 13:20 -0600, Jason Gerfen wrote:
> >>>
> >>>> I am running into a problem using the REGEXP option with filter_var().
> >>>>
> >>>> The string I am using: 09VolunteerApplication.doc
> >>>> The PCRE regex I am using:
> >>>> /^[a-z0-9]\.[doc|pdf|txt|jpg|jpeg|png|docx|csv|xls]{1,4}$/Di
> >>>>
> >>>> The function in it's entirety:
> >>>> return (!filter_var('09VolunteerApplication.doc',
> >>>> FILTER_VALIDATE_REGEXP,
> >>>> array('options'=>array('regexp'=>'/^[a-z0-9]\.[doc|pdf|txt|jpg|jpeg|png|docx|csv|xls]{1,4}$/Di'))))
> >>>> ? false : true;
> >>>>
> >>>> Anyone have any insight into this?
> >>>>
> >>>
> >>>
> >>> You missed a + in your regex, at the moment you're only checking to see
> >>> if a file starts with a single a-z or number and then is followed by the
> >>> period. Then you're checking for oddly for one to four extensions in the
> >>> list, are you sure you want to do that? And the square brackets are used
> >>> to match characters, not strings, use the standard brackets to allow
> >>> from a choice of strings
> >>>
> >>> Try this:
> >>>
> >>> '/^[a-z0-9]+\.(doc|pdf|txt|jpg|jpeg|png|docx|csv|xls)$/Di'
> >>>
> >>> One other thing you should be aware of maybe, filenames won't always
> >>> consist of just the letters a-z and numbers 0-9, they may contain
> >>> accented or foreign letters, hyphens, spaces and a number of other
> >>> characters depending on the client machines OS. Windows allows very few
> >>> characters for example compared to the Unix-like OS's like MacOS and
> >>> Linux.
> >>>
> >>
> >> Both are valid PCRE regex's. However the rules regarding usage of
> >> parenthesis for an XOR string does not explain a similar regex being
> >> used with the filter_var() like so:
> >>
> >> return (filter_var('kc-1', FILTER_VALIDATE_REGEXP,
> >> array('options'=>array('regexp'=>'/^[kc\-1|kc\-color|gr\-1|fa\-1|un\-1|un\-color|ben\-1|bencolor|sage\-1|sr\-1|st\-1]{1,8}$/Di')))
> >> ? true : false;
> >>
> >> The above returns string(4) "kc-1"
> >>
> >> Another test using the following works similarly:
> >>
> >> return (filter_var('u0368839', FILTER_VALIDATE_REGEXP,
> >> array('options'=>array('regexp'=>'/^[gp|u|gx]{1,2}[\d+]{6,15}$/Di'))) ?
> >> true : false;
> >>
> >> The above returns string(8) "u0368839"
> >>
> >> And
> >> return (filter_var('u0368839', FILTER_VALIDATE_REGEXP,
> >> array('options'=>array('regexp'=>'/^[gp|u|gx]{1,2}[\d+]{6,15}$/Di'))) ?
> >> true : false;
> >>
> >> returns string(8) "gp123456"
> >>
> >> As you can see these three examples use the start [] as XOR conditionals
> >> for multiple strings as prefixes.
> >>
> >>
> >>
> > 
> > 
> > Not quite, you think they match correctly because that's all you're
> > testing for, and you're not looking for anything that might disprove
> > that. Using your last example, it will also match these strings:
> > 
> > gu0368839
> > xx0368839
> > p0368839
> > 
> > 
> > I tested your first regex with '09VolunteerApplication.doc' and it
> > doesn't work at all until you add in that plus after the basename match
> > part of the regex:
> > 
> > ^[a-z0-9]+\.[doc|pdf|txt|jpg|jpeg|png|docx|csv|xls]{1,4}$
> > 
> > However, your regex (with the plus) also matches these strings:
> > 
> > 09VolunteerApplication.docp
> > 09VolunteerApplication.docj
> > 09VolunteerApplication.doc|    <-- note it's matching the literal bar
> > character
> > 
> > Making the changes I suggested (^[a-z0-9]+\.(doc|pdf|txt|jpg|jpeg|png|
> > docx|csv|xls)$) means the regex works as you expect. Square brackets in
> > a regex match a range, not a literal string, and without any sort of
> > modifier, match only a single instance of that range. So in your
> > example, you're matching a 4 character extension containing any of the
> > following characters '|cdfgjlnopstx', and a basename containing only 1
> > character that is either an a-z or a number.
> > 
> 
> You are right, after a few other tests I stand corrected. My apologies.
> However according to the documentation for filter_var() and the PCRE
> regexp option if it returns false, which it is, this is indicating an
> error with the regex.
> 
> In addition to this I would like to point out that the same regex using
> the older preg_match() function works as it should while the character
> class following by the pattern (+) fails the validation portion of the
> regex.
> 
> print_r(var_dump(filter_var('09VolunteerApplication.doc',
> FILTER_VALIDATE_REGEXP,
> array('options'=>array('regexp'=>'/^[a-z0-9]+\.(doc|pdf|txt|jpg|jpeg|png|docx|csv|xls){1,4}$/Di')))));
> 
> returns false (invalid regex) when using the character matching class
> [a-z0-9]+ with the filter_var() function with the FILTER_VALIDATE_REGEXP
> option
> 
> print_r(var_dump(preg_match('/^[a-z0-9]+\.(doc|pdf|txt|jpg|jpeg|png|docx|csv|xls){1,4}$/i',
> '09VolunteerApplication.doc')));
> 
> return int(1) indicating a valid regex as well as a valid match.
> 
> I believe this should be reported as a bug but I appreciate your
> assistance and insights.
> 
> 


Remove the {1,4} bit, as you're looking for 4 extensions. It's a valid
regex sure, but not the regex to match what you're looking for.

Out of interest, why are you using a regex here? Is this filename coming
from a form upload element?

-- 
Thanks,
Ash
http://www.ashleysheridan.co.uk



--- End Message ---
--- Begin Message ---
Can smbd please look  at this sentence - I got an error and do not
know how to fix it - I am still very unfamiliar with MYSQL:

CREATE TABLE log (  idlog int auto_increment not null,  imepriimek
varchar(50),  clock timestamp,  action varchar(30),  onfile
varchar(100), filesize float(6,2), uniqueid(idlog) );

ERROR 1064 (42000): You have an error in your SQL syntax; check the
manual that corresponds to your MySQL server version for the right
syntax to use near '(idlog) )' at line 1

-- When the sun rises I receive and when it sets I forgive ->
http://moj.skavt.net/gleskovs/
Always in Heart, Grega Leskovšek

--- End Message ---
--- Begin Message ---
Hello Grega,

What do you mean by uniqueid(idlog)?

-- 
With best regards from Ukraine,
Andre
Skype: Francophile
My blog: http://oire.org/menelion (mostly in Russian)
Twitter: http://twitter.com/m_elensule
Facebook: http://facebook.com/menelion

------------ Original message ------------
From: Grega Leskovšek <[email protected]>
To: php-general
Date created: , 5:29:44 PM
Subject: [PHP] mysql error


      Can smbd please look  at this sentence - I got an error and do not
know how to fix it - I am still very unfamiliar with MYSQL:

CREATE TABLE log (  idlog int auto_increment not null,  imepriimek
varchar(50),  clock timestamp,  action varchar(30),  onfile
varchar(100), filesize float(6,2), uniqueid(idlog) );

ERROR 1064 (42000): You have an error in your SQL syntax; check the
manual that corresponds to your MySQL server version for the right
syntax to use near '(idlog) )' at line 1

-- When the sun rises I receive and when it sets I forgive ->
http://moj.skavt.net/gleskovs/
Always in Heart, Grega Leskovšek

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



--- End Message ---
--- Begin Message ---
On Thu, May 5, 2011 at 10:29, Grega Leskovšek <[email protected]> wrote:
> Can smbd please look  at this sentence - I got an error and do not
> know how to fix it - I am still very unfamiliar with MYSQL:
>
> CREATE TABLE log (  idlog int auto_increment not null,  imepriimek
> varchar(50),  clock timestamp,  action varchar(30),  onfile
> varchar(100), filesize float(6,2), uniqueid(idlog) );
>
> ERROR 1064 (42000): You have an error in your SQL syntax; check the
> manual that corresponds to your MySQL server version for the right
> syntax to use near '(idlog) )' at line 1

    This is by no means a PHP question, and should not be asked on the
PHP General mailing list.  Please ask questions in the appropriate
place; for this, the MySQL General list is the correct forum, and
they've been CC'd.  In the future, if it relates to a PHP database
issue, you may want to use the PHP Database mailing list, also CC'd.
This not only means you'll get more on-target help faster, but also
helps in archiving data in the proper location for future searchers.

-- 
</Daniel P. Brown>
Network Infrastructure Manager
http://www.php.net/

--- End Message ---
--- Begin Message ---
On 5 May 2011 15:08, Mike Mackintosh <[email protected]> wrote:
> Sent from my iPhone

Why do all iPhone users apologies for sending mail from their iPhone.

It's like someone saying "Sorry, I've only got IE6".

-- 
Richard Quadling
Twitter : EE : Zend
@RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY

--- End Message ---
--- Begin Message ---
On Thu, May 5, 2011 at 9:52 AM, Richard Quadling <[email protected]> wrote:
> On 5 May 2011 15:08, Mike Mackintosh <[email protected]> wrote:
>> Sent from my iPhone
>
> Why do all iPhone users apologize for sending mail from their iPhone?

1. Apparently, iphone software top-posts replies. For some people,
that alone constitutes a federal (if not intergalactic) crime.

2. This signature addition seems to have started with the Blackberry.
Some people got upset with concise replies (like "fine") thinking them
to be snippy, when they were due to limited typing capabilities.

3. Advertising for Apple.

Ken

--- End Message ---
--- Begin Message ---

Jason Pruim

On May 5, 2011, at 12:29 PM, Ken Kixmoeller <[email protected]> wrote:

> On Thu, May 5, 2011 at 9:52 AM, Richard Quadling <[email protected]> wrote:
>> On 5 May 2011 15:08, Mike Mackintosh <[email protected]> wrote:
>>> Sent from my iPhone
>> 
>> Why do all iPhone users apologize for sending mail from their iPhone?
> 
> 1. Apparently, iphone software top-posts replies. For some people,
> that alone constitutes a federal (if not intergalactic) crime.

Very true...

> 
> 2. This signature addition seems to have started with the Blackberry.
> Some people got upset with concise replies (like "fine") thinking them
> to be snippy, when they were due to limited typing capabilities.

The signature can be set/moved on the iPhone depending on where you want it. 
> 
> 3. Advertising for Apple.

Like they need more? Hehe

Btw... Sent this from my iPhone :)

> 

--- End Message ---
--- Begin Message ---
On 5 May 2011 17:46, Jason Pruim <[email protected]> wrote:
>
>
> Jason Pruim
>
> On May 5, 2011, at 12:29 PM, Ken Kixmoeller <[email protected]> wrote:
>
>> On Thu, May 5, 2011 at 9:52 AM, Richard Quadling <[email protected]> wrote:
>>> On 5 May 2011 15:08, Mike Mackintosh <[email protected]> 
>>> wrote:
>>>> Sent from my iPhone
>>>
>>> Why do all iPhone users apologize for sending mail from their iPhone?
>>
>> 1. Apparently, iphone software top-posts replies. For some people,
>> that alone constitutes a federal (if not intergalactic) crime.
>
> Very true...
>
>>
>> 2. This signature addition seems to have started with the Blackberry.
>> Some people got upset with concise replies (like "fine") thinking them
>> to be snippy, when they were due to limited typing capabilities.
>
> The signature can be set/moved on the iPhone depending on where you want it.
>>
>> 3. Advertising for Apple.
>
> Like they need more? Hehe
>
> Btw... Sent this from my iPhone :)
>
>>
>

When I read it, it just looks like an apology. I'm imagining some
bowing and scraping fool desperately begging for forgiveness. Imagine
a cross between John Merrick and Quasimodo, with a big dollop of Igor
thrown in.

"Please forgive me master, I can only top post and tell the world I'm
a baaaaa, baaaa, baaaa!"


-- 
Richard Quadling
Twitter : EE : Zend
@RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY

--- End Message ---
--- Begin Message ---
Hi

I recently upgraded from PHP 5.2.3 to PHP 5.2.17.

After that, some of my pages keep failing with either Segfaults or calls to 
zend_mm_panic.  My gdb backtrace shows:

(gdb) bt
#0  zend_mm_panic (message=0xb71fbda4 "zend_mm_heap corrupted") at 
/src/php-5.2.17/Zend/zend_alloc.c:92
#1  0xb70a1555 in zend_mm_remove_from_free_list (heap=0x80a61c8, 
mm_block=0x422d97a4) at /src/php-5.2.17/Zend/zend_alloc.c:838
#2  0xb70a0a21 in _zend_mm_free_int (heap=0x80a61c8, p=0x422d9964) at 
/src/php-5.2.17/Zend/zend_alloc.c:1984
#3  0xb70a0f8e in _efree (ptr=0x422d97d4) at 
/src/php-5.2.17/Zend/zend_alloc.c:2311
#4  0xb70a91c9 in free_zend_constant (c=0x82f8398) at 
/src/php-5.2.17/Zend/zend_variables.h:35
#5  0xb70bc4cc in zend_hash_apply_deleter (ht=0x80a6978, p=0x82f8358) at 
/src/php-5.2.17/Zend/zend_hash.c:611
#6  0xb70bc7ba in zend_hash_reverse_apply (ht=0x80a6978, apply_func=0xb70a922c 
<clean_non_persistent_constant>)
    at /src/php-5.2.17/Zend/zend_hash.c:760
#7  0xb70a9523 in clean_non_persistent_constants () at 
/src/php-5.2.17/Zend/zend_constants.c:162
#8  0xb70aa1a5 in shutdown_executor () at 
/src/php-5.2.17/Zend/zend_execute_API.c:303
#9  0xb70b4a83 in zend_deactivate () at /src/php-5.2.17/Zend/zend.c:860
#10 0xb708102e in php_request_shutdown (dummy=0x0) at 
/src/php-5.2.17/main/main.c:1504
#11 0xb711106e in apache_php_module_main (r=0x828ce5c, display_source_mode=0) 
at /src/php-5.2.17/sapi/apache/sapi_apache.c:59
#12 0xb7111a5b in send_php (r=0x828ce5c, display_source_mode=0, filename=0x0) 
at /src/php-5.2.17/sapi/apache/mod_php5.c:666
#13 0xb7111b67 in send_parsed_php (r=0x828ce5c) at 
/src/php-5.2.17/sapi/apache/mod_php5.c:681
#14 0x08054aa4 in ap_invoke_handler ()
#15 0x0806a2db in process_request_internal ()
#16 0x0806a737 in ap_internal_redirect ()
#17 0x400a071f in mod_gzip_redir1_handler () from 
/adp/home/www_serv/libexec/mod_gzip.so
#18 0x4009eb06 in mod_gzip_handler () from 
/adp/home/www_serv/libexec/mod_gzip.so
#19 0x08054aa4 in ap_invoke_handler ()
#20 0x0806a2db in process_request_internal ()
#21 0x0806a33a in ap_process_request ()
#22 0x0806109c in child_main ()
#23 0x08061322 in make_child ()
#24 0x08061661 in perform_idle_server_maintenance ()
#25 0x08061c9a in standalone_main ()
#26 0x080622ba in main ()

Has anyone seen this before?  Any assistance would be greatly appreciated.

Thanks in advance,

Bruce
                                          

--- End Message ---

Reply via email to