php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #26768 substr_replace don't replace
Submitted: 2004-01-02 11:49 UTC Modified: 2004-01-02 17:57 UTC
From: pb at tdcspace dot dk Assigned:
Status: Closed Package: Unknown/Other Function
PHP Version: Irrelevant OS: NT
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
41 + 35 = ?
Subscribe to this entry?

 
 [2004-01-02 11:49 UTC] pb at tdcspace dot dk
Description:
------------
PHP 4.3.1 running on a web-host with NT!

Note: YES - i have tried to search for this bug !

A php-script to replace (change) varnames in other php-scripts. Quite simple - but it only works on smaller files i.e. substr_replace apparently does not work on a string of about 10k. Bug is: nothing is replaced by substr_replace but
returned unchanged !

short code ex:

$x = file_get_contents($fn);    // read source into string
$x = strtolower($x);          // make lowercase for search  
$p = strpos($x, $oldvarname);   // find varname
$x = substr_replace($x, $newvarname, $p, strlen($oldname));
...save the string to a file with changed varnames

as said - it works on smaller files/strings (2k) but not if the file/string is - say - 10k. 


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-01-02 12:47 UTC] jay@php.net
This is a pretty old version of PHP. Can you try using the 
latest version, PHP 4.3.4? 
 
J 
 [2004-01-02 17:57 UTC] pb at tdcspace dot dk
one own bugs is not anothers - subject closed
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Mar 28 13:01:28 2024 UTC