Mantis - Quercus
Viewing Issue Advanced Details
5769 minor always 07-04-14 09:47 07-04-14 09:47
tobia  
 
normal  
new  
open  
none    
none  
0005769: substr() with a negative 2nd argument larger than the string length
This affects the latest 4.0.39, but I couldn't find it in the version popup.

In vanilla PHP, calling substr() with a negative 2nd argument whose absolute value is larger than the string length results in the entire string being returned. Quercus returns false. Compare:

    var_export(substr("FooBar", -50));

This outputs 'FooBar' in vanilla PHP, but false in Quercus.

This is breaking Doctrine, see http://www.doctrine-project.org/api/orm/2.3/source-class-Doctrine.ORM.Mapping.DefaultQuoteStrategy.html#134 [^]

There are no notes attached to this issue.