php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #81065 Changes to Reflection modifiers not documented
Submitted: 2021-05-21 11:03 UTC Modified: 2021-05-23 12:40 UTC
From: yuki dot nishida at sys21 dot co dot jp Assigned:
Status: Closed Package: Reflection related
PHP Version: 7.3.28 OS: none
Private report: No CVE-ID: None
 [2021-05-21 11:03 UTC] yuki dot nishida at sys21 dot co dot jp
Description:
------------
The constant value is different in different versions, so it may need to be annotated.

ReflectionProperty (also ReflectionMethod)::IS_XXXX 
In my program, constant values are used in bitwise operations (logical products), and I noticed that I was facing a problem where bits with different numbers of digits could not be calculated with each other.
(Sorry, I'm Japanese and not good at English, so I'm using a translation tool, so please forgive any grammatical errors.

) I checked the source code from Git, and it is listed at the bottom of this column.

I apologize for the poor quality of this document, but I would appreciate it if you could help my future students.
Thank you for reading to the end.


-----checked the source code ------
[source1]
php-src/ext/reflection/php_reflection.c
// new (7.4)
6996	REGISTER_REFLECTION_CLASS_CONST_LONG(property, "IS_PUBLIC", ZEND_ACC_PUBLIC);
6997	REGISTER_REFLECTION_CLASS_CONST_LONG(property, "IS_PROTECTED", ZEND_ACC_PROTECTED);
6998	REGISTER_REFLECTION_CLASS_CONST_LONG(property, "IS_PRIVATE", ZEND_ACC_PRIVATE);

[source1]
php-src/Zend/zend_compile.h
// changed version (7.4)
 203	#define ZEND_ACC_PUBLIC                  (1 <<  0) /*     |  X  |  X  |  X  */ // -> 1
 204	#define ZEND_ACC_PROTECTED               (1 <<  1) /*     |  X  |  X  |  X  */ // -> 2
 205	#define ZEND_ACC_PRIVATE                 (1 <<  2) /*     |  X  |  X  |  X  */ // -> 4

//old (5.4) -> my use version... sory!!
 130	#define ZEND_ACC_PUBLIC		0x100 // ->  256
 131	#define ZEND_ACC_PROTECTED	0x200 // ->  512
 132	#define ZEND_ACC_PRIVATE	0x400 // -> 1024
 
// old (7.3.28)
 212	#define ZEND_ACC_PUBLIC                  (1 <<  8) /*     |  X  |  X  |  X  */ // ->  256
 213	#define ZEND_ACC_PROTECTED               (1 <<  9) /*     |  X  |  X  |  X  */ // ->  512
 214	#define ZEND_ACC_PRIVATE                 (1 << 10) /*     |  X  |  X  |  X  */ // -> 1024

Expected result:
----------------
https://www.php.net/manual/en/class.reflectionproperty

I think it would be desirable to have annotations added to this page.

Actual result:
--------------
There are no annotations.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2021-05-21 11:12 UTC] yuki dot nishida at sys21 dot co dot jp
I'm sorry!
I forgot about this one...(*'omega'*)

It's not on the changelog, which I think is the most confusing thing about it.
I'd like to see the change of the actual value of algebraic constants in the changelog.

I'm sorry. I'm sorry. I think this is the essence of what I want to request.
 [2021-05-21 11:17 UTC] imsop@php.net
I agree that the manual should be clearer here. There are probably other similar constants which are exposed from internal values and subject to change between versions.

* We should have a standard note such as "The values of constants may change between versions or environments. It is recommended to always use the constants directly and not rely on the values directly."
* Should we show the values for these at all, since users shouldn't be relying on them?
 [2021-05-21 11:34 UTC] cmb@php.net
-Status: Open +Status: Verified -Package: Unknown/Other Function +Package: Reflection related
 [2021-05-21 11:34 UTC] cmb@php.net
Ah, right, we either need to update the values (and add changelog
entries), or maybe not show the values at all.  We also need to
update related examples accordingly, e.g.
<https://www.php.net/manual/en/reflectionmethod.getmodifiers.php#refsect1-reflectionmethod.getmodifiers-examples>.
 [2021-05-23 12:40 UTC] cmb@php.net
-Summary: Display problems +Summary: Changes to Reflection modifiers not documented
 [2021-05-23 12:46 UTC] git@php.net
Automatic comment on behalf of cmb69
Revision: https://github.com/php/doc-en/commit/6f41560bf19de74e2dfbc78f4175d35f5b378abe
Log: Fix #81065: Changes to Reflection modifiers not documented
 [2021-05-23 12:46 UTC] git@php.net
-Status: Verified +Status: Closed
 [2021-05-23 15:54 UTC] git@php.net
Automatic comment on behalf of mumumu
Revision: https://github.com/php/doc-ja/commit/b328f5e58c2545943cc0ff015de7793a1a35eb0f
Log: Fix #81065: Changes to Reflection modifiers not documented
 [2021-05-24 05:26 UTC] yuki dot nishida at sys21 dot co dot jp
Thank you! (*‘ω‘ *)
I have confirmed that I have been corrected (added).
Glad to see that it was handled with great speed.
I admire you guys and hope to respond as quickly as you do.

Once again, thank you very much.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 18 19:01:30 2024 UTC