php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #16352 different implementation of str_replace on windows and linux
Submitted: 2002-03-29 15:29 UTC Modified: 2002-04-09 14:26 UTC
From: admin at students-fhtw dot de Assigned:
Status: Not a bug Package: Unknown/Other Function
PHP Version: 4.1.1 OS: windows
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: admin at students-fhtw dot de
New email:
PHP Version: OS:

 

 [2002-03-29 15:29 UTC] admin at students-fhtw dot de
str_replace() produces different output on windows and on linux:

php versions:
    windows: 4.1.1
    linux: 4.0.5

situation:
    I wanted to delete all quotations in a string, that came from GET query.

script:
    on linux:
$getQuery = str_replace("\"", "", $getQuery);
    on windows:
$getQuery = str_replace("\\\"", "", $getQuery);

conclusion:
    On windows, the character [\"] is not seen as one character but as two.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-04-09 12:01 UTC] jtate@php.net
???

On linux $getQuery = str_replace("\"", "", $getQuery);
On windows $getQuery = str_replace("\"", "", $getQuery);

\\ means \ \" means " so \\\" means \".
 [2002-04-09 14:08 UTC] admin at students-fhtw dot de
I know, what the escape characters mean.

The problem was, that I wanted to replace all quotations in a string which worked on linux with \" but on windows I had to write \\\" to achieve the replacement!
 [2002-04-09 14:18 UTC] sander@php.net
You're probably messing with different Magic Quotes settings.
This is really not a bug, you're doing something wrong.
 [2002-04-09 14:26 UTC] admin at students-fhtw dot de
You're right. It was my fault. The magic quotes settings were different.

I'm sorry having reported it as bug and thus stealing your time.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Jun 18 17:01:32 2024 UTC