Hi, I was trying to come up with an example for the https://wiki.php.net/rfc/internal_constructor_behaviour RFC and noticed some unexpected behavior.
Based on one of the examples: <?php var_dump(new ReflectionFunction([])); ?> In PHP 5.6 it will emit a Warning, and returns a unusable instance of ReflectionFunction, the latter of which should be resolved by the RFC above. Warning: ReflectionFunction::__construct() expects parameter 1 to be string, array given In PHP 7b3 (and going back to b1 at least), it now throws a TypeError on the mis-match. I would expect this behavior in strict type mode, but not by default. (see: http://3v4l.org/jQQtX). The same if you do new PDO([]); but it would have returned a null previously. Yes, the result is the same, in both cases, an exception should be thrown, but it should be Constructor failed (the exact exception seems to change depending on the class you're instantiating). In some cases, this behavior is as expected: new MessageFormatter('en_US', null); Will result in an IntlException with message "Constructor failed" (see: http://3v4l.org/uAjUr) I discussed this with Anthony and he pointed out this commit by nikic as the change that introduced this behavior: https://github.com/php/php-src/pull/1215 I believe that internal functions and methods should only emit a warning (as per 5.x) for incorrect argument types, unless (1) it's a constructor failure, and (2) you're not using strict mode. Thoughts?