php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #76472 Array functions ignore object property permissions
Submitted: 2018-06-13 16:28 UTC Modified: 2021-07-23 12:32 UTC
Votes:1
Avg. Score:3.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:0 (0.0%)
From: php at darkain dot com Assigned:
Status: Wont fix Package: Scripting Engine problem
PHP Version: 7.2.6 OS: Debian 9
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
MUST BE VALID
Solve the problem:
2 + 42 = ?
Subscribe to this entry?

 
 [2018-06-13 16:28 UTC] php at darkain dot com
Description:
------------
Using foreach on an object, protected/private members are skipped over.

Using current(), next(), prev(), end(), reset() on an object, private/protected members are accessible.

These functions entirely bypass object property permissions.

Test script:
---------------
This effects all versions of PHP.

https://3v4l.org/5e6Ok


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2021-07-23 12:32 UTC] nikic@php.net
-Status: Open +Status: Wont fix
 [2021-07-23 12:32 UTC] nikic@php.net
Using current() etc. with objects is deprecated as of PHP 8.1, so this will get resolved in due time. We're not going to change the behavior in the meantime.

Relevant RFC: https://wiki.php.net/rfc/deprecations_php_8_1#key_current_next_prev_reset_on_objects
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 18 00:01:28 2024 UTC