strip_tags stripping hyphen
Posted by dabbler (dabbler), 18 June 2003Hello.
I'm having trouble with a script which is validating data provided in a form field, it's removing the hyphen/dash.
When I remove strip_tags, it no longer removes the hyphens, which seems completely bizarre as it's only supposed to remove the html and php tags. Is there a better workaround than removing it completely from all occurences? This does not seem to be a problem for other people, and I'm thinking this may be a quirk of my server's php setup (IIS5) somehow. Unless I'm completely overlooking something else.
Posted by admin (Graham Ellis), 18 June 2003Very odd one - nothing obvious that I can see. Can you reproduce the problem in a smaller program? Here's a very simple piece of PHP based on your code:
That's a complete working example and it DID work for me - stripping out tags, leaving - signs alone. If you can run my program on your server and find a string for which it fails ... then try it out on my machine http://www.wellho.net/demo/odd.php4 and see if it's a problem there ... should at least help give some clues.
Posted by dabbler (dabbler), 18 June 2003Thanks! Still strips the hyphen, it ignores every other symbol except the hyphen. However it works fine when I use it on your server, as I expected.
Is this a bug in my hosts version of php or a configuration problem that I can make them aware of?
PHP Version 4.3.2RC3
System Windows NT GALILEO 5.0 build 2195
Build Date May 16 2003 00:32:10
Server API CGI/FastCGI
Virtual Directory Support enabled
Configuration File (php.ini) Path C:\WINNT\php.ini
PHP API 20020918
PHP Extension 20020429
Zend Extension 20021010
I found this, sounds suspiciously like my problem:
I've let my host know.
Posted by admin (Graham Ellis), 18 June 2003Yep, that's the one
Your ISP is running a test version of PHP - a "release candidate". RC versions are expected to be released, but the last stage of testing is to have them out there with people for a short while to find any last minute problems. Personally, I would run a release candidate on my development system, but I wouldn't put it on a main live server, especially if that server had a lot of users doing many different things.
Your ISP is using 4.3.2RC3 (something of a clue here - it's the THIRD release candidate!) and the problem report is for RC4. The fix was applied in the source tree on 16th May - that's prior to the full release on 29th May of 4.3.2.
In other words
* Naughty ISP - using test software versions!
* There is now a released, fixed version they should upgrade to
Posted by dabbler (dabbler), 18 June 2003Thanks for the clue, wasn't aware what rc meant. Now I know, and will whip them into shape. I can't complain too much, they are affordable, for small timers like me.
Thanks for the help though. Appreciated. I'll remove the offending function temporarily and restore it later when they've updated, as they have already assured me they would schedule it.
PH: 01144 1225 708225 • FAX: 01144 1225 899360 • EMAIL: email@example.com • WEB: http://www.wellho.net • SKYPE: wellho