Skip to content

Conversation

Tyrael
Copy link
Contributor

@Tyrael Tyrael commented Mar 29, 2015

the current way of setting the context options through stream_context_set_default is really clunky (and can cause side-effects as it modifies the global context options obviously).


if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|l", &url, &url_len, &format) == FAILURE) {
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|lr", &url, &url_len, &format, &zcontext) == FAILURE) {
Copy link
Member

Choose a reason for hiding this comment

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

I'd use s|lr! here to allow passing null. Otherwise the change looks great :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

thanks, updated the PR with that.

@Tyrael Tyrael force-pushed the get_headers_optional_context branch from d2742a6 to b9b0d3d Compare March 30, 2015 09:22
php_stream *stream;
zval *prev_val, *hdr = NULL, *h;
HashTable *hashT;
zend_long format = 0;
zval *zcontext = NULL;
php_stream_context *context = NULL;
Copy link
Member

Choose a reason for hiding this comment

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

It's unnecessary to set it to NULL, since context will be always assigned below..

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yeah, but we do the same in file_get_contents, so I thought I would follow suit:
http://lxr.php.net/xref/PHP_TRUNK/ext/standard/file.c#527

Copy link
Member

Choose a reason for hiding this comment

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

then it should also be improved..

Copy link
Member

Choose a reason for hiding this comment

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

"improved", since compiler is smart enough to optimize it anyway..

@cmb69
Copy link
Member

cmb69 commented Sep 2, 2015

That would have been a welcome improvement for PHP 7.0. Maybe we can get it in for PHP 7.1? :)

@Tyrael
Copy link
Contributor Author

Tyrael commented Sep 2, 2015

yeah. I wasn't sure if it needs an rfc or not then I took the feature freeze seriously.
will be merging into master after PHP-7.0 is branched out.

@php-pulls php-pulls merged commit 0a10440 into php:master Oct 8, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants