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

From: Date: Sun, 11 Dec 2016 01:05:47 +0000
Subject: Doc #73715 [NEW]: Undocumented change in 7.0 of call_user_func + get_object_vars
Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-14210@lists.php.net to get a copy of this message
From: love at sickpeople dot se Operating system: PHP version: Irrelevant Package: Documentation problem Bug Type: Documentation Problem Bug description:Undocumented change in 7.0 of call_user_func + get_object_vars 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 bug report at https://bugs.php.net/bug.php?id=73715&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=73715&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=73715&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=73715&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=73715&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=73715&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=73715&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=73715&r=needscript Try newer version: https://bugs.php.net/fix.php?id=73715&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=73715&r=support Expected behavior: https://bugs.php.net/fix.php?id=73715&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=73715&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=73715&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=73715&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=73715&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=73715&r=dst IIS Stability: https://bugs.php.net/fix.php?id=73715&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=73715&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=73715&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=73715&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=73715&r=mysqlcfg

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