-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
extends Tarantool in PHP 7.2 bug #135
Comments
Should be fixed in 108b658 |
I would even propose to mark the |
Are there a reason to forbid inheritance? Aren't you have idea why MongoDB does? |
The proper initialization is important for correct work of an inherited class. I cannot provide exact description what was broken and becomes right, but at least the test case with inherited class with a property starts to work correctly. Some online materials strongly suggest to call object_properties_init() function in a create_object handler, see [1], [2], [3]. The problem was catched at the existing test suite on mocking tests when phpunit was updated to 6.5.14 (now it is 4.8.24) and appropriate changes were made for the tests (say, using of createMock() instead of getMock()). So this commit is prerequisite to run the test suite on more fresh phpunit, which is necessary to test the connector on php-7.1+. The changes for php-7.1+ will land in future commits. It seems the problem was introduced in [4]. [1]: https://wiki.php.net/internals/engine/objects [2]: http://www.phpinternalsbook.com/php5/classes_objects/custom_object_storage.html [3]: https://phabricator.wikimedia.org/T59292 [4]: 9f5a282 ('updated PHP7 implementation') Fixes #135.
The proper initialization is important for correct work of an inherited class. I cannot provide exact description what was broken and becomes right, but at least the test case with inherited class with a property starts to work correctly. Some online materials strongly suggest to call object_properties_init() function in a create_object handler, see [1], [2], [3]. The problem was catched at the existing test suite on mocking tests when phpunit was updated to 6.5.14 (now it is 4.8.24) and appropriate changes were made for the tests (say, using of createMock() instead of getMock()). So this commit is prerequisite to run the test suite on more fresh phpunit, which is necessary to test the connector on php-7.1+. The changes for php-7.1+ will land in future commits. It seems the problem was introduced in [4]. [1]: https://wiki.php.net/internals/engine/objects [2]: http://www.phpinternalsbook.com/php5/classes_objects/custom_object_storage.html [3]: https://phabricator.wikimedia.org/T59292 [4]: 9f5a282 ('updated PHP7 implementation') Fixes #135.
I believe they just follow best practices. There are plenty of articles on the Internet explaining the pros and cons of composition over inheritance:
Personally, I can't think of any use case in which I would want to extend the |
i've tried to make a class with predefined auth credentials to use constructor without any params. |
Thanks for the feedback! My near goal is to revive the connector (php 7.* support, packages, bugfixes) and I surely will not introduce changes that may break backward compatibility (at least within two near releases). I'll close the issue as the bug (with standard property initialization fix). We can consider this proposal again if we'll decide to evolve the connector further (don't sure now). |
@eugenchenko, I would use factory for that.
Fair enough. |
The proper initialization is important for correct work of an inherited class. I cannot provide exact description what was broken and becomes right, but at least the test case with inherited class with a property starts to work correctly. Some online materials strongly suggest to call object_properties_init() function in a create_object handler, see [1], [2], [3]. The problem was catched at the existing test suite on mocking tests when phpunit was updated to 6.5.14 (now it is 4.8.24) and appropriate changes were made for the tests (say, using of createMock() instead of getMock()). So this commit is prerequisite to run the test suite on more fresh phpunit, which is necessary to test the connector on php-7.1+. The changes for php-7.1+ will land in future commits. It seems the problem was introduced in [4]. [1]: https://wiki.php.net/internals/engine/objects [2]: http://www.phpinternalsbook.com/php5/classes_objects/custom_object_storage.html [3]: https://phabricator.wikimedia.org/T59292 [4]: 9f5a282 ('updated PHP7 implementation') Fixes #135.
The proper initialization is important for correct work of an inherited class. I cannot provide exact description what was broken and becomes right, but at least the test case with inherited class with a property starts to work correctly. Some online materials strongly suggest to call object_properties_init() function in a create_object handler, see [1], [2], [3]. The problem was catched at the existing test suite on mocking tests when phpunit was updated to 6.5.14 (now it is 4.8.24) and appropriate changes were made for the tests (say, using of createMock() instead of getMock()). So this commit is prerequisite to run the test suite on more fresh phpunit, which is necessary to test the connector on php-7.1+. The changes for php-7.1+ will land in future commits. It seems the problem was introduced in [4]. [1]: https://wiki.php.net/internals/engine/objects [2]: http://www.phpinternalsbook.com/php5/classes_objects/custom_object_storage.html [3]: https://phabricator.wikimedia.org/T59292 [4]: 9f5a282 ('updated PHP7 implementation') Fixes #135.
The proper initialization is important for correct work of an inherited class. I cannot provide exact description what was broken and becomes right, but at least the test case with inherited class with a property starts to work correctly. Some online materials strongly suggest to call object_properties_init() function in a create_object handler, see [1], [2], [3]. The problem was catched at the existing test suite on mocking tests when phpunit was updated to 6.5.14 (now it is 4.8.24) and appropriate changes were made for the tests (say, using of createMock() instead of getMock()). So this commit is prerequisite to run the test suite on more fresh phpunit, which is necessary to test the connector on php-7.1+. The changes for php-7.1+ will land in future commits. It seems the problem was introduced in [4]. [1]: https://wiki.php.net/internals/engine/objects [2]: http://www.phpinternalsbook.com/php5/classes_objects/custom_object_storage.html [3]: https://phabricator.wikimedia.org/T59292 [4]: 9f5a282 ('updated PHP7 implementation') Fixes #135.
Fixed in |
Example #1:
Example #2:
PHP 7.2.7-1+0
20180622080852.23+jessie1.gbpfd8e2e (cli) (built: Jun 22 2018 09:18:17) ( NTS )Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
with Zend OPcache v7.2.7-1+0
20180622080852.23+jessie1.gbpfd8e2e, Copyright (c) 1999-2018, by Zend TechnologiesThe text was updated successfully, but these errors were encountered: