Hi everybody,

 

I don't know if this is the right place  to report bugs. please let me know
for the next time.

This is a small snippet  that shows the wrong behaviour :

 

<?php

$line  = str_repeat(' ',20); $value ='03'; $pos=0; $len='2';

$line = substr_replace($line,$value,$pos,$len);

echo "[$line]\n";

?>

 

When running it under php 7, $line is unchanged and a message is emitted :

PHP Warning:  substr_replace(): 'from' and 'len' should be of same type -
numerical or array  in test.php on line 3.

 

$len is not auto-casted in integer..  Btw the message is not very clear as
it mentions from and len that are not within the doc.

(in my real source code, $len was extracted as string from a database).

When $len is an integer, the function works as expected.

 

 

Tested ok        on php 5.3.10

Tested Not ok on php 7.0.3

 

Best regards,

Pascal KISSIAN

Reply via email to