Skip to content
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

Change XMLWriter resources to objects #4706

Closed
wants to merge 1 commit into from

Conversation

cmb69
Copy link
Member

@cmb69 cmb69 commented Sep 14, 2019

While we generally prefer objects over resources for quite a while, the
procedural XMLWriter API still uses resources, although there is
already an object-oriented API which uses objects. This dichotomy
makes no sense, slightly complicates the implementation, and doesn't
allow a stepwise migration to the object-oriented API, which might be
desired. Thus we completely drop the XMLWriter resources in favor of
XMLWriter objects.

We consider the minor BC break acceptable for a major version, since
only explicit type checks (is_resource(), gettype() etc.) need to
be adapted.

While we generally prefer objects over resources for quite a while, the
procedural XMLWriter API still uses resources, although there is
already an object-oriented API which uses objects.  This dichotomy
makes no sense, slightly complicates the implementation, and doesn't
allow a stepwise migration to the object-oriented API, which might be
desired.  Thus we completely drop the XMLWriter resources in favor of
XMLWriter objects.

We consider the minor BC break acceptable for a major version, since
only explicit type checks (`is_resource()`, `gettype()` etc.) need to
be adapted.
@KalleZ
Copy link
Member

KalleZ commented Sep 14, 2019

Is there any side effects of mixing usage of procedural and OO usage now or now redundant methods? (Been a while since I worked with XMLWriter myself so I can't remember)

@cmb69
Copy link
Member Author

cmb69 commented Sep 14, 2019

@KalleZ, formerly procedural and OO couldn't be mixed at all; with this patch it is possible, and basically either API is now redundant. Maybe we want to deprecate the procedural API some time.

@KalleZ
Copy link
Member

KalleZ commented Sep 14, 2019

Ack

Copy link
Member

@nikic nikic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LG. You might want to consider migrating most of these methods to zend_parse_method_parameters() as a followup, which exists specifically for these types of mixed procedural+OO APIs.

@cmb69
Copy link
Member Author

cmb69 commented Sep 18, 2019

Applied as d61bc63.

Thanks for hinting at zend_parse_method_parameters(). I'll have a look.

@cmb69 cmb69 closed this Sep 18, 2019
@cmb69 cmb69 deleted the xmlwriter-objects branch September 18, 2019 06:54
@carusogabriel carusogabriel added this to the PHP 8.0 milestone May 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants