Doc #73715 [Opn]: Undocumented change in 7.0 of call_user_func + get_object_vars

From: Date: Sun, 11 Dec 2016 01:09:53 +0000
Subject: Doc #73715 [Opn]: Undocumented change in 7.0 of call_user_func + get_object_vars
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-14211@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=73715&edit=1 ID: 73715 User updated by: love at sickpeople dot se Reported by: love at sickpeople dot se Summary: Undocumented change in 7.0 of call_user_func + get_object_vars Status: Open Type: Documentation Problem Package: Documentation problem PHP Version: Irrelevant Block user comment: N Private report: N New Comment: I posted the wrong links to the migration. I have verified that I checked the guide for 7.0 in 1). Correct links http://php.net/manual/en/migration70.incompatible.php http://php.net/manual/en/migration70.changed-functions.php Previous Comments: ------------------------------------------------------------------------ [2016-12-11 01:05:44] love at sickpeople dot se Description: ------------ In PHP 5 it was possible to invoke get_object_vars() with call_user_func() in order to get only public variables. This is no longer the case. 1) I can't find any documentation about this change on the pages for get_object_vars, call_user_func OR the migration for 7.0 (grepping for 'scope') 2) This upvoted comment introduced the hack with call_user_func() to me: http://php.net/manual/en/function.get-object-vars.php#113435 I suggest two things A) Add an editor note on the comment mentioned in 2). Tell that this only works in PHP 5 B) Add more info in http://php.net/manual/en/migration71.incompatible.php or http://php.net/manual/en/migration71.changed-functions.php - I presume this is not a change in call_user_func() or get_object_vars() themselves. I was not able to find what the source of this change actually is, hence more info of *some kind* is requested. Test script: --------------- class M { protected $A = 'foo'; private $B = 'bar'; public Function dump () { var_dump ( array_keys (get_object_vars ($this)), array_keys (call_user_func ('get_object_vars', $this)) ); return $this; } } var_dump (get_object_vars ((new M)->dump ())); Expected result: ---------------- https://3v4l.org/94ES3 - The result between PHP 5 and PHP 7 differs ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=73715&edit=1

« previous php.doc.bugs (#14211) next »