mirror of
https://github.com/php/php-src.git
synced 2026-03-27 01:32:22 +01:00
Previously: * If only ["" => "x"] was present, the original string was returned without warning. * If both ["" => "x"] and at least one more element was present, false was returned without warning. New behavior: * Ignore "" keys in the replacement array (and perform any remaining replacement). * Throw a warning indicating that an empty string replacement has been ignored. Closes GH-4792.
16 lines
350 B
PHP
16 lines
350 B
PHP
--TEST--
|
|
strtr() trying to replace an empty string
|
|
--FILE--
|
|
<?php
|
|
|
|
var_dump(strtr("foo", ["" => "bar"]));
|
|
var_dump(strtr("foo", ["" => "bar", "x" => "y"]));
|
|
|
|
?>
|
|
--EXPECTF--
|
|
Warning: strtr(): Ignoring replacement of empty string in %s on line %d
|
|
string(3) "foo"
|
|
|
|
Warning: strtr(): Ignoring replacement of empty string in %s on line %d
|
|
string(3) "foo"
|