php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #71190 substr_replace converts integers in original $search array to strings
Submitted: 2015-12-22 04:03 UTC Modified: -
From: laruence@php.net Assigned:
Status: Closed Package: *General Issues
PHP Version: 7.0.1 OS:
Private report: No CVE-ID: None
 [2015-12-22 04:03 UTC] laruence@php.net
Description:
------------
none

Test script:
---------------
<?php
$b = [0, 1, 2];

var_dump($b);
substr_replace("test", $b, "1");
var_dump($b);

Expected result:
----------------
array(3) {
  [0]=>
  int(0)
  [1]=>
  int(1)
  [2]=>
  int(2)
}
array(3) {
  [0]=>
  int(0)
  [1]=>
  int(1)
  [2]=>
  int(2)
}

Actual result:
--------------
array(3) {
  [0]=>
  int(0)
  [1]=>
  int(1)
  [2]=>
  int(2)
}
array(3) {
  [0]=>
  string(1) "0"
  [1]=>
  int(1)
  [2]=>
  int(2)
}
[Tue Dec 22 12:03:13 2015]  Script:  '/tmp/1.php'
/home/huixinchen/opensource/php-7.0/Zend/zend_string.h(121) :  Freeing 0x7FFFF8059D00 (32 bytes), script=/tmp/1.php
=== Total 1 memory leaks detected ===

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2015-12-22 04:29 UTC] laruence@php.net
Automatic comment on behalf of laruence@gmail.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=d63ae2c3822f43567aa5e40f3067183001900c39
Log: Fixed bug #71190 (substr_replace converts integers in original $search array to strings)
 [2015-12-22 04:29 UTC] laruence@php.net
-Status: Open +Status: Closed
 [2016-07-20 11:34 UTC] davey@php.net
Automatic comment on behalf of laruence@gmail.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=d63ae2c3822f43567aa5e40f3067183001900c39
Log: Fixed bug #71190 (substr_replace converts integers in original $search array to strings)
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Mar 19 09:01:30 2024 UTC