sebastianbergmann/diff

Fatal when diffing integers

mathiasverraes opened this issue · 2 comments

<?php
use SebastianBergmann\Diff\Differ;
$differ = new Differ;
print $differ->diff(1, 2);

results in

PHP Catchable fatal error:  Argument 1 passed to 
SebastianBergmann\Diff\Differ::selectLcsImplementation() 
must be of the type array, integer given, called in src/Differ.php 
on line 198 and defined in src/Differ.php on line 254

diff('foo', 'bar') (with string arguments) works as expected. A workaround is to to cast the arguments to string.

Thanks for the report, I will look into this. But why would you want to diff non-strings? Just curious.

I don't know what the type of the values will be. I guess I could check the
types at runtime, but I think that job is better left to Diff.


Mathias Verraes
Software Consultant
Value Object Comm.V http://value-object.com
Blog http://verraes.net/ - Email mathias@verraes.net - Twitter
http://twitter.com/mathiasverraes - LinkedIn
https://www.linkedin.com/in/mathiasverraes

On 22 February 2015 at 16:00, Sebastian Bergmann notifications@github.com
wrote:

Thanks for the report, I will look into this. But why would you want to
diff non-strings? Just curious.


Reply to this email directly or view it on GitHub
#25 (comment)
.