-
Notifications
You must be signed in to change notification settings - Fork 807
PHP 8.4: Document StreamBucket
#4297
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
Conversation
<varlistentry> | ||
<term> | ||
<property>dataLength</property> | ||
(<type>int</type>) | ||
</term> | ||
<listitem> | ||
<para> | ||
<parameter>dataLength</parameter> <literal>bucket</literal> The length of the string in the bucket. | ||
</para> | ||
</listitem> | ||
</varlistentry> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't we just remove the property description now? I would rather have something along the lines of:
Prior to PHP 8.4.0, an
stdClass
containing the same properties asStreamBucket
was returned.
Then duplicating documentation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, good point! I wasn't sure if we want to keep these docs or not, so I left it there. But I agree, these are just noise after adding the StreamBucket page.
reference/stream/streambucket.xml
Outdated
<para> | ||
<simplelist> | ||
<member><function>stream_bucket_new</function></member> | ||
<member><function>stream_bucket_append</function></member> | ||
<member><function>stream_bucket_prepend</function></member> | ||
<member><function>stream_bucket_make_writeable</function></member> | ||
</simplelist> | ||
</para> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No useless wrapping para tags
<para> | |
<simplelist> | |
<member><function>stream_bucket_new</function></member> | |
<member><function>stream_bucket_append</function></member> | |
<member><function>stream_bucket_prepend</function></member> | |
<member><function>stream_bucket_make_writeable</function></member> | |
</simplelist> | |
</para> | |
<simplelist> | |
<member><function>stream_bucket_new</function></member> | |
<member><function>stream_bucket_append</function></member> | |
<member><function>stream_bucket_prepend</function></member> | |
<member><function>stream_bucket_make_writeable</function></member> | |
</simplelist> |
reference/stream/streambucket.xml
Outdated
<section role="seealso"> | ||
&reftitle.seealso; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indent is off
reference/stream/streambucket.xml
Outdated
<varlistentry xml:id="streambucket.props.bucket"> | ||
<term>resource <varname>bucket</varname></term> | ||
<listitem> | ||
<para>A <literal>userfilter.bucket</literal> resource.</para> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use simpara now, and use new lines for the descriptions. Apply for the other properties.
<para>A <literal>userfilter.bucket</literal> resource.</para> | |
<simpara> | |
A <literal>userfilter.bucket</literal> resource. | |
</simpara> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the difference between the two?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Roughly, simpara
is like a HTML p
while para
is more like a div
.
reference/stream/streambucket.xml
Outdated
<para> | ||
A stream bucket is a chunk of stream which can be extracted from bucket brigades. | ||
</para> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<para> | |
A stream bucket is a chunk of stream which can be extracted from bucket brigades. | |
</para> | |
<simpara> | |
A stream bucket is a chunk of stream which can be extracted from bucket brigades. | |
</simpara> |
<refsect1 role="changelog"> | ||
&reftitle.changelog; | ||
<informaltable> | ||
<tgroup cols="2"> | ||
<thead> | ||
<row> | ||
<entry>&Version;</entry> | ||
<entry>&Description;</entry> | ||
</row> | ||
</thead> | ||
<tbody> | ||
<row> | ||
<entry>8.4.0</entry> | ||
<entry> | ||
This function returns a <classname>StreamBucket</classname> instance now; | ||
previously, an <classname>stdClass</classname> was returned. | ||
</entry> | ||
</row> | ||
</tbody> | ||
</tgroup> | ||
</informaltable> | ||
</refsect1> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Feels like the changelogs could just XInclude the one from stream_bucket_append()
to prevent duplication.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TBH I'm not sure it's worth the effort for only two places to include. 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Xincluding is not really more difficult than copy pasting.
StreamBucket
<varlistentry> | ||
<term> | ||
<property>dataLength</property> | ||
(<type>int</type>) | ||
</term> | ||
<listitem> | ||
<para> | ||
<parameter>dataLength</parameter> <literal>bucket</literal> The length of the string in the bucket. | ||
</para> | ||
</listitem> | ||
</varlistentry> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Co-authored-by: Christoph M. Becker <cmbecker69@gmx.de>
</listitem> | ||
</varlistentry> | ||
</variablelist> | ||
Returns a bucket object or &null;. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When does it return null
actually?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As far as I managed to understand https://github.com/php/php-src/blob/d6d78545ea405e89a44445a9a32d77a75fd8bb6b/ext/standard/user_filters.c#L356, it returns null if the brigade is empty (?). The 2nd part of the condition seems to be always non-null (bucket
variable).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, at least under ZendMM, php_stream_bucket_make_writeable()
cannot return NULL; that code is from 2003; maybe we should move the php_stream_bucket_make_writeable()
inside the if-branch.
Anyhow, reading the manual helps understanding the implementation. E.g. the info on https://www.php.net/manual/en/function.stream-bucket-append.php explains everything; and https://www.php.net/manual/en/function.stream-bucket-make-writeable.php (emphasis mine):
This function is called whenever there is the need to access and operate on the content contains in a brigade.
is also quite entertaining. ;)
Might not make sense to try to figure out this particular return value meaning for now.
@Girgias Is there anything else I should fix in order to merge this? |
Adding docs for the
StreamBucket
class.