Doc->Bug #79521 [Opn]: `__set_state` structure not been checked

From: Date: Sun, 26 Apr 2020 13:08:20 +0000
Subject: Doc->Bug #79521 [Opn]: `__set_state` structure not been checked
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-226776@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=79521&edit=1 ID: 79521 Updated by: carusogabriel@php.net Reported by: carusogabriel@php.net -Summary: Fix __set_state documentation +Summary: __set_state structure not been checked Status: Open -Type: Documentation Problem +Type: Bug Package: Class/Object related PHP Version: Irrelevant Block user comment: N Private report: N New Comment: I've opened https://github.com/php/php-src/pull/5462 to fix this. Indeed, not a documentation problem, we need to fix it. Previous Comments: ------------------------------------------------------------------------ [2020-04-26 03:39:09] carusogabriel@php.net > Sorry, by ignored I meant that the type doesn't matter. :+1: > It really should return an object, though. It's what the method is for. In this case, we'd need an RFC removing that functionality, right? > And I totally didn't notice the RFC was yours. I'll shut up now :) Comments are always welcome, don't shut up ;) ------------------------------------------------------------------------ [2020-04-26 03:26:30] requinix@php.net Sorry, by ignored I meant that the type doesn't matter. It really should return an object, though. It's what the method is for. And I totally didn't notice the RFC was yours. I'll shut up now :) ------------------------------------------------------------------------ [2020-04-26 03:14:24] carusogabriel@php.net Related To: Bug #69718 ------------------------------------------------------------------------ [2020-04-26 03:13:11] carusogabriel@php.net > It doesn't include __set_state, but this is likely just an oversight. Yeah, I'm working on that right now, that's why I come up with this bug report. > The return value is simply being ignored. Also not an error. It isn't: it does change the result based on the type: - https://3v4l.org/jt3jL (string) - https://3v4l.org/tIHi3 (object) This is supported by the engine: https://github.com/php/php-src/blob/d21d23afef54f152d9ca661909c6d042d6bfcf48/ext/standard/var.c#L472-L593 > and it is not an error to pass more arguments than are defined in a function signature. It is not an error, this is why the documentation needs to be updated, right? ------------------------------------------------------------------------ [2020-04-26 03:06:10] requinix@php.net The fact that you can get away without arguments is for the usual reasons: the signature of __set_state is not enforced by the engine, and it is not an error to pass more arguments than are defined in a function signature. The return value is simply being ignored. Also not an error. Related: the magic-methods-signature RFC https://wiki.php.net/rfc/magic-methods-signature It doesn't include __set_state, but this is likely just an oversight. See also bug #69718 ------------------------------------------------------------------------ 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=79521 -- Edit this bug report at https://bugs.php.net/bug.php?id=79521&edit=1

« previous php.bugs (#226776) next »