1--TEST-- 2Bug #39621 (str_replace() is not binary safe on strings with equal length) 3--FILE-- 4<?php 5 6$search = "qxxx\0qqqqqqqq"; 7$subject = "qxxx\0xxxxxxxx"; 8$replace = "any text"; 9 10$result = str_replace ( $search, $replace, $subject ); 11 12var_dump($result); 13 14$search = "QXXX\0qqqqqqqq"; 15$subject = "qxxx\0xxxxxxxx"; 16$replace = "any text"; 17 18$result = str_ireplace ( $search, $replace, $subject ); 19 20var_dump($result); 21 22$search = "qxxx\0xxxxxxxx"; 23$subject = "qxxx\0xxxxxxxx"; 24$replace = "any text"; 25 26$result = str_replace ( $search, $replace, $subject ); 27 28var_dump($result); 29 30$search = "qXxx\0xXxXxXxx"; 31$subject = "qxXx\0xxxxxxxx"; 32$replace = "any text"; 33 34$result = str_ireplace ( $search, $replace, $subject ); 35 36var_dump($result); 37 38echo "Done\n"; 39?> 40--EXPECT-- 41string(13) "qxxxxxxxxxxx" 42string(13) "qxxxxxxxxxxx" 43string(8) "any text" 44string(8) "any text" 45Done 46