From: "Brian Smither" on 30 Sep 2010 11:43 I found this code... if (version_compare(PHP_VERSION, '5.2.0', '>=')) { $text=filter_var($text, FILTER_SANITIZE_URL); } ....to be questionable. Under what conditions would version_compare() return true, yet the filter_var() be undefined? Because that's what is happening. Thank you.
From: shiplu on 30 Sep 2010 12:01 On Thu, Sep 30, 2010 at 9:43 PM, Brian Smither <bhsmither(a)gmail.com> wrote: > > I found this code... > if (version_compare(PHP_VERSION, '5.2.0', '>=')) { It means condition (PHP_VERSION >= 5.2.0) > Â $text=filter_var($text, FILTER_SANITIZE_URL); > } > > ...to be questionable. > > Under what conditions would version_compare() return true, yet the filter_var() be undefined? Because that's what is happening. > > Thank you. > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- Shiplu Mokadd.im My talks, http://talk.cmyweb.net Follow me, http://twitter.com/shiplu SUST Programmers, http://groups.google.com/group/p2psust Innovation distinguishes bet ... ... (ask Steve Jobs the rest)
From: Paul M Foster on 30 Sep 2010 12:03 On Thu, Sep 30, 2010 at 09:43:22AM -0600, Brian Smither wrote: > > I found this code... > if (version_compare(PHP_VERSION, '5.2.0', '>=')) { > $text=filter_var($text, FILTER_SANITIZE_URL); > } > > ...to be questionable. > > Under what conditions would version_compare() return true, yet the filter_var() be undefined? Because that's what is happening. If your PHP was compiled without support for the filter functions? I assume when you say that filter_var() is "undefined" you mean that the software returns a message that the function itself cannot be found? Paul -- Paul M. Foster
From: Jim Lucas on 30 Sep 2010 12:37 Brian Smither wrote: > I found this code... > if (version_compare(PHP_VERSION, '5.2.0', '>=')) { > $text=filter_var($text, FILTER_SANITIZE_URL); > } > > ...to be questionable. > > Under what conditions would version_compare() return true, yet the filter_var() be undefined? Because that's what is happening. > > Thank you. > > > > Personally, I would change that to be if ( function_exists('filter_var') ) { $text = filter_var($text, FILTER_SANITIZE_URL); } Jim
From: "Brian Smither" on 30 Sep 2010 12:52 >Personally, I would change that to be >if ( function_exists('filter_var') ) { So would I: *But it's not my code. *I wish to learn and understand the cause of the problem - not walk around it. >It means condition (PHP_VERSION >= 5.2.0) I understand that. There was a second, more relevant, part to my question. I have found the version of PHP used as reported in the HTTP header responses. filter_var() is undefined in PHP/5.2.4_p20070914-pl2-gentoo
|
Next
|
Last
Pages: 1 2 Prev: file_get_contents() failing on CentOS. Next: filter_var (was: Re: [PHP] version_compare) |