Bug #71428 [Ver->Csd]: Validation type inheritance with = NULL

From: Date: Tue, 29 Mar 2016 08:58:17 +0000
Subject: Bug #71428 [Ver->Csd]: Validation type inheritance with = NULL
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-200198@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=71428&edit=1 ID: 71428 Updated by: krakjoe@php.net Reported by: dpa-bugs at aegee dot org Summary: Validation type inheritance with = NULL -Status: Verified +Status: Closed Type: Bug Package: Class/Object related PHP Version: 7.0.2 Block user comment: N Private report: N New Comment: Automatic comment on behalf of krakjoe Revision: http://git.php.net/?p=php-src.git;a=commit;h=dd70c39556fe6efe2e1f28cecf8fc73d9588d04a Log: fix bug #71428: Validation type inheritance with = NULL Previous Comments: ------------------------------------------------------------------------ [2016-03-28 10:53:58] bwoebi@php.net It's technically a BC break, but at the same time a big LSP violation bug. If you relied on that, your code is technically anyway broken. (as passing null to a typehint of superclass should break,) ------------------------------------------------------------------------ [2016-03-28 10:14:01] inefedor at gmail dot com I wonder if we should go through RFC stage for that supposedly BC-breaking fix? ------------------------------------------------------------------------ [2016-03-28 07:14:28] krakjoe@php.net There are bugs in * zend_do_perform_type_hint_check (never verifies compatibility of zend_arg_info.allow_null) * zend_get_function_declaration The bugs in zend_get_function_declaration are because we make this assumption: if (i >= required && !arg_info->is_variadic) So do not generate the correct error message when you fix the type hint check. It's 8am on Monday morning ... someone else should have a go ... ------------------------------------------------------------------------ [2016-03-23 21:20:22] dpa-bugs at aegee dot org In all examples, you cannot pass NULL as first parameter to the derived m(), but you can bass NULL as first parameter to parent::m(). So the method signature changes, in terms of possible values that can be supplied. ------------------------------------------------------------------------ [2016-03-23 17:05:18] danielgarthsims at gmail dot com Is this a bug? I don't see why it's a problem. Looking at the nikic's example, the method signature doesn't change, just the default value for the method. In the original example, you're still requiring two variables, but the second one can no longer be null. I'm not sure what the expected behavior should be. ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at https://bugs.php.net/bug.php?id=71428 -- Edit this bug report at https://bugs.php.net/bug.php?id=71428&edit=1

« previous php.bugs (#200198) next »