| Newsgroups |
gmane.comp.php.documentation.general |
| Message-ID |
<[email protected]> |
Hello PHP EN Documentation team,
There are contributions within the online editor queue for this language.
Please review, then commit or delete these patches.
Patches for review :
-----------------------
New file: en/reference/sqlite3/sqlite3/backup.xml
By: BohwaZ on 2019-12-01 14:40:58
===================================================================
--- en/reference/sqlite3/sqlite3/backup.xml
+++ en/reference/sqlite3/sqlite3/backup.xml
@@ -0,0 +1,112 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<refentry xml:id="sqlite3.backup" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
+ <refnamediv>
+ <refname>SQLite3::backup</refname>
+ <refpurpose>Creates a backup of the current SQLite database using the Online Backup API</refpurpose>
+ </refnamediv>
+
+ <refsect1 role="description">
+ &reftitle.description;
+ <methodsynopsis>
+ <modifier>public</modifier> <type>bool</type><methodname>SQLite3::backup</methodname>
+ <methodparam><type>SQLite3</type><parameter>destination_db</parameter></methodparam>
+ <methodparam choice="opt"><type>string</type><parameter>source_dbname</parameter><initializer>"main"</initializer></methodparam>
+ <methodparam choice="opt"><type>string</type><parameter>destination_dbname</parameter><initializer>"main"</initializer></methodparam>
+ </methodsynopsis>
+ <para>
+ Creates a backup of the SQLite database to the destination database object passed as first parameter, using the <link xlink:href="https://www.sqlite.org/backup.html">online backup API</link>.
+ You can specify the names of source and destination names databases if you have attached one.
+ </para>
+ </refsect1>
+
+ <refsect1 role="parameters">
+ &reftitle.parameters;
+ <para>
+ <variablelist>
+ <varlistentry>
+ <term><parameter>destination_db</parameter></term>
+ <listitem>
+ <para>
+ SQLite3 database object for the destination of the backup.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term><parameter>source_dbname</parameter></term>
+ <listitem>
+ <para>
+ Name of the source database.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term><parameter>destination_dbname</parameter></term>
+ <listitem>
+ <para>
+ Name of the destination database.
+ </para>
+ </listitem>
+ </varlistentry>
+ </variablelist>
+ </para>
+ <para>
+ The default destination and source database name is <literal>"main"</literal>, but any name of a database opened using <literal>ATTACH</literal> can be used.
+ </para>
+ <para>Note that if you have created temporary tables using <literal>CREATE TEMP TABLE</literal>, they can be backed up using <literal>"temp"</literal> as a database name.
+ </para>
+ </refsect1>
+
+ <refsect1 role="returnvalues">
+ &reftitle.returnvalues;
+ <para>
+ This method will return true or generate an error or an exception if it fails.
+ </para>
+ </refsect1>
+
+ <refsect1 role="errors">
+ &reftitle.errors;
+ <para>
+ If the database is locked or is busy, this method will throw an exception or generate an error.
+ </para>
+ </refsect1>
+
+ <refsect1 role="examples">
+ &reftitle.examples;
+ <para>
+ <example>
+ <title>Simple backup example</title>
+ <programlisting role="php">
+<![CDATA[
+<?php
+$db = new SQLite3('data.sqlite');
+$db->backup(new SQLite3('backup.sqlite'));
+?>
+]]>
+ </programlisting>
+ </example>
+ </para>
+ </refsect1>
+
+</refentry>
+
+<!-- Keep this comment at the end of the file
+Local variables:
+mode: sgml
+sgml-omittag:t
+sgml-shorttag:t
+sgml-minimize-attributes:nil
+sgml-always-quote-attributes:t
+sgml-indent-step:1
+sgml-indent-data:t
+indent-tabs-mode:nil
+sgml-parent-document:nil
+sgml-default-dtd-file:"~/.phpdoc/manual.ced"
+sgml-exposed-tags:nil
+sgml-local-catalogs:nil
+sgml-local-ecat-files:nil
+End:
+vim600: syn=xml fen fdm=syntax fdl=2 si
+vim: et tw=78 syn=sgml
+vi: ts=1 sw=1
+-->
=> Put this change into your patches : https://edit.php.net/?project=php&action=putIntoMyPatches&idDB=97065
=> Delete this change: https://edit.php.net/?project=php&action=deleteThisChange&idDB=97065
------------------------------------------------------------------
Modified: en/reference/spl/functions/iterator-to-array.xml
By: Joel Wurtz on 2019-01-09 08:31:37
===================================================================
--- en/reference/spl/functions/iterator-to-array.xml
+++ en/reference/spl/functions/iterator-to-array.xml
@@ -138,6 +138,44 @@
]]>
</screen>
</example>
+ <example>
+ <title><function>iterator_to_array</function> with Generator example</title>
+ <programlisting role="php">
+<![CDATA[
+<?php
+
+function yield1() {
+ yield 'foo';
+}
+
+function yield2() {
+ yield 'bar';
+
+ yield from yield1();
+}
+
+var_dump(iterator_to_array(yield2(), false));
+var_dump(iterator_to_array(yield2(), true));
+
+?>
+]]>
+ </programlisting>
+ &example.outputs;
+ <screen>
+<![CDATA[
+array(2) {
+ [0]=>
+ string(3) "bar"
+ [1]=>
+ string(3) "foo"
+}
+array(1) {
+ [0]=>
+ string(3) "foo"
+}
+]]>
+ </screen>
+ </example>
</para>
</refsect1>
=> Put this change into your patches : https://edit.php.net/?project=php&action=putIntoMyPatches&idDB=89165
=> Delete this change: https://edit.php.net/?project=php&action=deleteThisChange&idDB=89165
------------------------------------------------------------------
Modified: en/reference/openssl/functions/openssl-encrypt.xml
By: anonymous on 2019-01-13 05:08:52
===================================================================
--- en/reference/openssl/functions/openssl-encrypt.xml
+++ en/reference/openssl/functions/openssl-encrypt.xml
@@ -187,22 +187,23 @@
$ivlen = openssl_cipher_iv_length($cipher="AES-128-CBC");
$iv = openssl_random_pseudo_bytes($ivlen);
$ciphertext_raw = openssl_encrypt($plaintext, $cipher, $key, $options=OPENSSL_RAW_DATA, $iv);
-$hmac = hash_hmac('sha256', $ciphertext_raw, $key, $as_binary=true);
-$ciphertext = base64_encode( $iv.$hmac.$ciphertext_raw );
-
-//decrypt later....
+$hmac = hash_hmac('sha256', $iv.$ciphertext_raw, $key, $as_binary=true);
+$ciphertext = base64_encode( $iv.$ciphertext_raw.$hmac );
+//decrypt later...
+$sha2len = 32;
$c = base64_decode($ciphertext);
-$ivlen = openssl_cipher_iv_length($cipher="AES-128-CBC");
-$iv = substr($c, 0, $ivlen);
-$hmac = substr($c, $ivlen, $sha2len=32);
-$ciphertext_raw = substr($c, $ivlen+$sha2len);
-$original_plaintext = openssl_decrypt($ciphertext_raw, $cipher, $key, $options=OPENSSL_RAW_DATA, $iv);
-$calcmac = hash_hmac('sha256', $ciphertext_raw, $key, $as_binary=true);
+$hmac = substr($c, -1*$sha2len);
+$hmac_input = substr($c, 0, -1*$sha2len);
+$calcmac = hash_hmac('sha256', $hmac_input, $key, $as_binary=true);
if (hash_equals($hmac, $calcmac))//PHP 5.6+ timing attack safe comparison
{
+ $ivlen = openssl_cipher_iv_length($cipher="AES-128-CBC");
+ $iv = substr($c, 0, $ivlen);
+ $ciphertext_raw = substr($c, $ivlen, -1*$sha2len);
+ $original_plaintext = openssl_decrypt($ciphertext_raw, $cipher, $key, $options=OPENSSL_RAW_DATA, $iv);
echo $original_plaintext."n";
}
-?>
+
]]>
</programlisting>
</example>
=> Put this change into your patches : https://edit.php.net/?project=php&action=putIntoMyPatches&idDB=89229
=> Delete this change: https://edit.php.net/?project=php&action=deleteThisChange&idDB=89229
------------------------------------------------------------------
Modified: en/reference/reflection/reflectionclass/getmodifiers.xml
By: Florian Berberich on 2019-02-17 03:35:34
===================================================================
--- en/reference/reflection/reflectionclass/getmodifiers.xml
+++ en/reference/reflection/reflectionclass/getmodifiers.xml
@@ -31,12 +31,113 @@
modifier constants</link>.
</para>
</refsect1>
+
+ <refsect1 role="changelog">
+ &reftitle.changelog;
+ <para>
+ <informaltable>
+ <tgroup cols="2">
+ <thead>
+ <row>
+ <entry>&Version;</entry>
+ <entry>&Description;</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry>7.2.0</entry>
+ <entry>
+ The returned bitfield now only consists on the value of the
+ <link linkend="reflectionclass.constants.modifiers">modifier constants.</link>
+ </entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </informaltable>
+ </para>
+ </refsect1>
+
+ <refsect1 role="examples">
+ &reftitle.examples;
+ <para>
+ <example>
+ <title><methodname>ReflectionClass::getModifiers</methodname> example</title>
+ <programlisting role="php">
+<![CDATA[
+<?php
+
+trait Trait1 {
+
+}
+
+trait Trait2 {
+ abstract function abstract1();
+}
+
+interface Interface1 {
+
+}
+
+interface Interface2 {
+ function abstract2();
+}
+
+abstract class Abstract1 {
+
+}
+
+abstract class Abstract2 {
+ abstract function abstract3();
+}
+
+class Class1 {
+
+}
+
+final class Class2 {
+
+}
+
+$refTrait1 = new ReflectionClass('Trait1');
+$refTrait2 = new ReflectionClass('Trait2'); // implicit abstract
+$refInterface1 = new ReflectionClass('Interface1');
+$refInterface2 = new ReflectionClass('Interface2'); // implicit abstract
+$refAbstract1 = new ReflectionClass('Abstract1'); // explicit abstract
+$refAbstract2 = new ReflectionClass('Abstract2'); // implicit and explicit abstract
+$refClass1 = new ReflectionClass('Class1');
+$refClass2 = new ReflectionClass('Class2'); // final
+
+var_dump($refTrait1->getModifiers());
+var_dump($refTrait2->getModifiers());
+var_dump($refInterface1->getModifiers());
+var_dump($refInterface2->getModifiers());
+var_dump($refAbstract1->getModifiers());
+var_dump($refAbstract2->getModifiers());
+var_dump($refClass1->getModifiers());
+var_dump($refClass2->getModifiers());
+]]>
+ </programlisting>
+ &example.outputs;
+ <screen>
+<![CDATA[
+int(0)
+int(16)
+int(0)
+int(16)
+int(32)
+int(48)
+int(0)
+int(4)
+]]>
+ </screen>
+ </example>
+ </para>
+ </refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
- <member><methodname>ReflectionClass::getProperties</methodname></member>
<member><methodname>Reflection::getModifierNames</methodname></member>
</simplelist>
</para>
=> Put this change into your patches : https://edit.php.net/?project=php&action=putIntoMyPatches&idDB=89789
=> Delete this change: https://edit.php.net/?project=php&action=deleteThisChange&idDB=89789
------------------------------------------------------------------
Modified: en/reference/reflection/reflectionclass.xml
By: Florian Berberich on 2019-02-17 03:37:49
===================================================================
--- en/reference/reflection/reflectionclass.xml
+++ en/reference/reflection/reflectionclass.xml
@@ -2,13 +2,13 @@
<!-- $Revision: 321705 $ -->
<phpdoc:classref xml:id="class.reflectionclass" xmlns:phpdoc="http://php.net/ns/phpdoc" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xi="http://www.w3.org/2001/XInclude">
-
+
<title>The ReflectionClass class</title>
<titleabbrev>ReflectionClass</titleabbrev>
-
+
<partintro>
-
-<!-- {{{ ReflectionClass intro -->
+
+ <!-- {{{ ReflectionClass intro -->
<section xml:id="reflectionclass.intro">
&reftitle.intro;
<para>
@@ -16,16 +16,16 @@
information about a class.
</para>
</section>
-<!-- }}} -->
-
+ <!-- }}} -->
+
<section xml:id="reflectionclass.synopsis">
&reftitle.classsynopsis;
-
-<!-- {{{ Synopsis -->
+
+ <!-- {{{ Synopsis -->
<classsynopsis>
<ooclass><classname>ReflectionClass</classname></ooclass>
-
-<!-- {{{ Class synopsis -->
+
+ <!-- {{{ Class synopsis -->
<classsynopsisinfo>
<ooclass>
<classname>ReflectionClass</classname>
@@ -35,7 +35,7 @@
<interfacename>Reflector</interfacename>
</oointerface>
</classsynopsisinfo>
-<!-- }}} -->
+ <!-- }}} -->
<classsynopsisinfo role="comment">&Constants;</classsynopsisinfo>
<fieldsynopsis>
<modifier>const</modifier>
@@ -53,25 +53,25 @@
<modifier>const</modifier>
<type>integer</type>
<varname linkend="reflectionclass.constants.is-final">ReflectionClass::IS_FINAL</varname>
- <initializer>64</initializer>
+ <initializer>4</initializer>
</fieldsynopsis>
-
+
<classsynopsisinfo role="comment">&Properties;</classsynopsisinfo>
<fieldsynopsis>
<modifier>public</modifier>
<varname linkend="reflectionclass.props.name">name</varname>
</fieldsynopsis>
-
+
<classsynopsisinfo role="comment">&Methods;</classsynopsisinfo>
<xi:include xpointer="xmlns(db=http://docbook.org/ns/docbook) xpointer(id('class.reflectionclass')/db:refentry/db:refsect1[@role='description']/descendant::db:methodsynopsis[1])" />
</classsynopsis>
-<!-- }}} -->
-
+ <!-- }}} -->
+
</section>
-
-<!-- {{{ ReflectionClass properties -->
+
+ <!-- {{{ ReflectionClass properties -->
<section xml:id="reflectionclass.props">
&reftitle.properties;
<variablelist>
@@ -86,36 +86,39 @@
</varlistentry>
</variablelist>
</section>
-<!-- }}} -->
-
+ <!-- }}} -->
-<!-- {{{ ReflectionClass constants -->
+
+ <!-- {{{ ReflectionClass constants -->
<section xml:id="reflectionclass.constants">
&reftitle.constants;
<section xml:id="reflectionclass.constants.modifiers">
<title>ReflectionClass Modifiers</title>
<variablelist>
-
+
<varlistentry xml:id="reflectionclass.constants.is-implicit-abstract">
<term><constant>ReflectionClass::IS_IMPLICIT_ABSTRACT</constant></term>
<listitem>
<para>
- Indicates class that is <link linkend="language.oop5.abstract">
- abstract</link> because it has some abstract methods.
+ Indicates class is <link linkend="language.oop5.abstract">
+ abstract</link> because it has some abstract methods. This may
+ also be true for interfaces and traits that containt abstract
+ methods.
</para>
</listitem>
</varlistentry>
-
+
<varlistentry xml:id="reflectionclass.constants.is-explicit-abstract">
<term><constant>ReflectionClass::IS_EXPLICIT_ABSTRACT</constant></term>
<listitem>
<para>
- Indicates class that is <link linkend="language.oop5.abstract">
- abstract</link> because of its definition.
+ Indicates class is <link linkend="language.oop5.abstract">
+ abstract</link> because of its definition. This is only true for
+ abstract classes.
</para>
</listitem>
</varlistentry>
-
+
<varlistentry xml:id="reflectionclass.constants.is-final">
<term><constant>ReflectionClass::IS_FINAL</constant></term>
<listitem>
@@ -125,17 +128,72 @@
</para>
</listitem>
</varlistentry>
-
+
</variablelist>
</section>
</section>
-<!-- }}} -->
-
-
+ <!-- }}} -->
+
+ <section role="changelog" xml:id="reflectionclass.changelog"><!-- {{{ -->
+ &reftitle.changelog;
+ <para>
+ <informaltable>
+ <tgroup cols="2">
+ <thead>
+ <row>
+ <entry>&Version;</entry>
+ <entry>&Description;</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry>7.2.0</entry>
+ <entry>
+ Added method: <methodname>isIterable</methodname>.
+ <methodname>isIterateable</methodname> is now an alias of
+ the new method.
+ </entry>
+ </row>
+ <row>
+ <entry>7.1.0</entry>
+ <entry>
+ Added methods: <methodname>getReflectionConstant</methodname>
+ and <methodname>getReflectionConstants</methodname>.
+ </entry>
+ </row>
+ <row>
+ <entry>7.0.0</entry>
+ <entry>
+ The value of <constant>ReflectionClass::IS_FINAL</constant>
+ changed from 64 to 4.
+ </entry>
+ </row>
+ <row>
+ <entry>7.0.0</entry>
+ <entry>
+ Added method: <methodname>isAnonymous</methodname>
+ </entry>
+ </row>
+ <row>
+ <entry>5.4.0</entry>
+ <entry>
+ Added methods: <methodname>isCloneable</methodname>,
+ <methodname>newInstanceWithoutConstructor</methodname>,
+ <methodname>getTraits</methodname>, <methodname>
+ getTraitNames</methodname>, <methodname>getTraitAliases
+ </methodname> and <methodname>isTrait</methodname>.
+ </entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </informaltable>
+ </para>
+ </section><!-- }}} -->
+
</partintro>
-
+
&reference.reflection.entities.reflectionclass;
-
+
</phpdoc:classref>
<!-- Keep this comment at the end of the file
=> Put this change into your patches : https://edit.php.net/?project=php&action=putIntoMyPatches&idDB=89783
=> Delete this change: https://edit.php.net/?project=php&action=deleteThisChange&idDB=89783
------------------------------------------------------------------
Modified: en/reference/reflection/reflectionclass/isiterable.xml
By: Florian Berberich on 2019-02-17 03:41:52
===================================================================
--- en/reference/reflection/reflectionclass/isiterable.xml
+++ en/reference/reflection/reflectionclass/isiterable.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
-<!-- $Revision: 346865 $ -->
+<!-- $Revision: 344522 $ -->
<refentry xml:id="reflectionclass.isiterable" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
@@ -14,7 +14,8 @@
<void />
</methodsynopsis>
<para>
- Check whether this class is iterable (i.e. can be used inside &foreach;).
+ Checks whether the class implements the interface <interfacename>Traversable</interfacename>
+ and is actually iterable. Therefore abstract classes are not iterable.
</para>
</refsect1>
@@ -34,12 +35,12 @@
&reftitle.examples;
<para>
<example>
- <title>Basic <methodname>ReflectionClass::isIterable</methodname> Usage</title>
+ <title><methodname>ReflectionClass::isIterable</methodname> example</title>
<programlisting role="php">
<![CDATA[
<?php
-class IteratorClass implements Iterator {
+abstract class IteratorClass implements Iterator {
public function __construct() { }
public function key() { }
public function current() { }
@@ -50,16 +51,16 @@
class DerivedClass extends IteratorClass { }
class NonIterator { }
-function dump_iterable($class) {
+function dump_iterateable($class) {
$reflection = new ReflectionClass($class);
- var_dump($reflection->isIterable());
+ var_dump($reflection->isIterateable());
}
$classes = array("ArrayObject", "IteratorClass", "DerivedClass", "NonIterator");
foreach ($classes as $class) {
- echo "Is $class iterable? ";
- dump_iterable($class);
+ echo "Is $class iterateable? ";
+ dump_iterateable($class);
}
?>
]]>
@@ -67,25 +68,15 @@
&example.outputs;
<screen>
<![CDATA[
-Is ArrayObject iterable? bool(true)
-Is IteratorClass iterable? bool(true)
-Is DerivedClass iterable? bool(true)
-Is NonIterator iterable? bool(false)
+Is ArrayObject iterateable? bool(true)
+Is IteratorClass iterateable? bool(false)
+Is DerivedClass iterateable? bool(true)
+Is NonIterator iterateable? bool(false)
]]>
</screen>
</example>
</para>
</refsect1>
-
- <refsect1 role="seealso">
- &reftitle.seealso;
- <para>
- <simplelist>
- <member><methodname>ReflectionClass::__construct</methodname></member>
- </simplelist>
- </para>
- </refsect1>
-
</refentry>
<!-- Keep this comment at the end of the file
=> Put this change into your patches : https://edit.php.net/?project=php&action=putIntoMyPatches&idDB=89791
=> Delete this change: https://edit.php.net/?project=php&action=deleteThisChange&idDB=89791
------------------------------------------------------------------
Modified: en/reference/funchand/functions/func-get-args.xml
By: HongWeipeng on 2019-04-07 11:53:10
===================================================================
--- en/reference/funchand/functions/func-get-args.xml
+++ en/reference/funchand/functions/func-get-args.xml
@@ -3,7 +3,7 @@
<refentry xml:id="function.func-get-args" xmlns="http://docbook.org/ns/docbook">
<refnamediv>
<refname>func_get_args</refname>
- <refpurpose>Returns an array comprising a function's argument list</refpurpose>
+ <refpurpose>Returns an array of arguments passed to the function</refpurpose>
</refnamediv>
<refsect1 role="description">
@@ -13,7 +13,7 @@
<void/>
</methodsynopsis>
<para>
- Gets an array of the function's argument list.
+ Gets an array of arguments passed to the function.
</para>
<para>
This function may be used in conjunction with
@@ -26,7 +26,7 @@
&reftitle.returnvalues;
<para>
Returns an array in which each element is a copy of the corresponding
- member of the current user-defined function's argument list.
+ member passed into the current user-defined function's argument list.
</para>
</refsect1>
=> Put this change into your patches : https://edit.php.net/?project=php&action=putIntoMyPatches&idDB=91074
=> Delete this change: https://edit.php.net/?project=php&action=deleteThisChange&idDB=91074
------------------------------------------------------------------
Modified: en/reference/dom/domnamednodemap/getnameditem.xml
By: anonymous on 2019-06-12 10:40:52
===================================================================
--- en/reference/dom/domnamednodemap/getnameditem.xml
+++ en/reference/dom/domnamednodemap/getnameditem.xml
@@ -10,7 +10,7 @@
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
- <type>DOMNode</type><methodname>DOMNamedNodeMap::getNamedItem</methodname>
+ <type>DOMAttr</type><methodname>DOMNamedNodeMap::getNamedItem</methodname>
<methodparam><type>string</type><parameter>name</parameter></methodparam>
</methodsynopsis>
<para>
=> Put this change into your patches : https://edit.php.net/?project=php&action=putIntoMyPatches&idDB=92531
=> Delete this change: https://edit.php.net/?project=php&action=deleteThisChange&idDB=92531
------------------------------------------------------------------
Modified: en/reference/dom/domnamednodemap/getnameditemns.xml
By: anonymous on 2019-06-12 10:41:03
===================================================================
--- en/reference/dom/domnamednodemap/getnameditemns.xml
+++ en/reference/dom/domnamednodemap/getnameditemns.xml
@@ -10,7 +10,7 @@
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
- <type>DOMNode</type><methodname>DOMNamedNodeMap::getNamedItemNS</methodname>
+ <type>DomAttr</type><methodname>DOMNamedNodeMap::getNamedItemNS</methodname>
<methodparam><type>string</type><parameter>namespaceURI</parameter></methodparam>
<methodparam><type>string</type><parameter>localName</parameter></methodparam>
</methodsynopsis>
=> Put this change into your patches : https://edit.php.net/?project=php&action=putIntoMyPatches&idDB=92532
=> Delete this change: https://edit.php.net/?project=php&action=deleteThisChange&idDB=92532
------------------------------------------------------------------
Modified: en/reference/memcached/constants.xml
By: on 2019-06-19 14:06:36
===================================================================
--- en/reference/memcached/constants.xml
+++ en/reference/memcached/constants.xml
@@ -248,7 +248,7 @@
<listitem>
<para>In non-blocking mode this set the value of the timeout during socket
connection, in milliseconds.</para>
- <para>Type: <literal>integer</literal>, default: <literal>1000</literal>.</para>
+ <para>Type: <literal>integer</literal>, default: <literal>4000</literal>.</para>
</listitem>
</varlistentry>
@@ -257,7 +257,7 @@
<listitem>
<para>The amount of time, in seconds, to wait until retrying a failed
connection attempt.</para>
- <para>Type: <literal>integer</literal>, default: <literal>0</literal>.</para>
+ <para>Type: <literal>integer</literal>, default: <literal>2</literal>.</para>
</listitem>
</varlistentry>
@@ -285,7 +285,7 @@
<term><constant>Memcached::OPT_POLL_TIMEOUT</constant></term>
<listitem>
<para>Timeout for connection polling, in milliseconds.</para>
- <para>Type: <literal>integer</literal>, default: <literal>1000</literal>.</para>
+ <para>Type: <literal>integer</literal>, default: <literal>5000</literal>.</para>
</listitem>
</varlistentry>
@@ -303,7 +303,7 @@
<para>Specifies the failure limit for server connection attempts. The
server will be removed after this many continuous connection
failures.</para>
- <para>Type: <literal>integer</literal>, default: <literal>0</literal>.</para>
+ <para>Type: <literal>integer</literal>, default: <literal>5</literal>.</para>
</listitem>
</varlistentry>
=> Put this change into your patches : https://edit.php.net/?project=php&action=putIntoMyPatches&idDB=92604
=> Delete this change: https://edit.php.net/?project=php&action=deleteThisChange&idDB=92604
------------------------------------------------------------------
Modified: en/reference/simplexml/simplexmlelement/addChild.xml
By: jbnahan on 2019-08-05 01:25:33
===================================================================
--- en/reference/simplexml/simplexmlelement/addChild.xml
+++ en/reference/simplexml/simplexmlelement/addChild.xml
@@ -17,9 +17,19 @@
</methodsynopsis>
<para>
Adds a child element to the node and returns a SimpleXMLElement of the child.
+
</para>
</refsect1>
-
+
+ <refsect1 role="notes"><!-- {{{ -->
+ &reftitle.notes;
+ <caution>
+ <para>
+ The parameter <param>value</param> is supposed to be a piece of XML CDATA, so it allows entity references.
+ </para>
+ </caution>
+ </refsect1><!-- }}} -->
+
<refsect1 role="parameters">
&reftitle.parameters;
<para>
@@ -51,7 +61,7 @@
</variablelist>
</para>
</refsect1>
-
+
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
@@ -59,7 +69,7 @@
object representing the child added to the XML node.
</para>
</refsect1>
-
+
<refsect1 role="examples">
&reftitle.examples;
<para>
@@ -143,7 +153,7 @@
</example>
</para>
</refsect1>
-
+
<refsect1 role="seealso">
&reftitle.seealso;
<para>
=> Put this change into your patches : https://edit.php.net/?project=php&action=putIntoMyPatches&idDB=93376
=> Delete this change: https://edit.php.net/?project=php&action=deleteThisChange&idDB=93376
------------------------------------------------------------------
Modified: en/install/fpm/configuration.xml
By: psi / Kaede Fujisaki on 2019-08-17 07:45:40
===================================================================
--- en/install/fpm/configuration.xml
+++ en/install/fpm/configuration.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
-<!-- $Revision: 349711 $ -->
+<!-- $Revision: 346281 $ -->
<sect1 xml:id="install.fpm.configuration" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<title>Configuration</title>
<para>
@@ -260,8 +260,7 @@
</term>
<listitem>
<para>
- Set listen(2) backlog. A value of '-1' means unlimited. Default value:
- -1.
+ Set listen(2) backlog. Default value: 511 (-1 on FreeBSD and OpenBSD).
</para>
</listitem>
</varlistentry>
@@ -758,7 +757,7 @@
</para>
<para>
Settings defined with <literal>php_admin_value</literal> and <literal>php_admin_flag</literal>
- cannot be overridden with <function>ini_set</function>.
+ cannot be overriden with <function>ini_set</function>.
</para>
<para>
As of 5.3.3, PHP settings are also possible to be set in webserver.
=> Put this change into your patches : https://edit.php.net/?project=php&action=putIntoMyPatches&idDB=93678
=> Delete this change: https://edit.php.net/?project=php&action=deleteThisChange&idDB=93678
------------------------------------------------------------------
Modified: en/language/oop5/static.xml
By: [email protected] on 2019-08-28 10:20:54
===================================================================
--- en/language/oop5/static.xml
+++ en/language/oop5/static.xml
@@ -18,9 +18,9 @@
<para>
Declaring class properties or methods as static makes them accessible
- without needing an instantiation of the class. A property declared as
- static cannot be accessed with an instantiated class object (though
- a static method can).
+ without needing an instantiation of the class. Prior to PHP 5.3, a property declared as
+ static could not be accessed with an instantiated class object (though
+ a static method could).
</para>
<para>
=> Put this change into your patches : https://edit.php.net/?project=php&action=putIntoMyPatches&idDB=93839
=> Delete this change: https://edit.php.net/?project=php&action=deleteThisChange&idDB=93839
------------------------------------------------------------------
Modified: en/reference/datetime/dateinterval/createfromdatestring.xml
By: Stuart Jones on 2019-09-02 03:44:20
===================================================================
--- en/reference/datetime/dateinterval/createfromdatestring.xml
+++ en/reference/datetime/dateinterval/createfromdatestring.xml
@@ -6,7 +6,7 @@
<refname>DateInterval::createFromDateString</refname>
<refpurpose>Sets up a DateInterval from the relative parts of the string</refpurpose>
</refnamediv>
-
+
<refsect1 role="description">
&reftitle.description;
<methodsynopsis role="oop">
@@ -18,7 +18,7 @@
parts of the parsed string.
</para>
</refsect1>
-
+
<refsect1 role="parameters">
&reftitle.parameters;
<para>
@@ -38,7 +38,7 @@
</variablelist>
</para>
</refsect1>
-
+
<refsect1 role="examples">
&reftitle.examples;
<para>
@@ -74,14 +74,56 @@
</example>
</para>
</refsect1>
-
+
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Returns a new <classname>DateInterval</classname> instance.
</para>
</refsect1>
-
+
+ <refsect1 role="returnvalues">
+ &reftitle.returnvalues;
+ <para>
+ Returns a new <classname>DateInterval</classname> instance.
+ As of PHP 7.2.17 and 7.3.4, this method will return false if passed a badly
+ formatted <parameter>time</parameter> argument.
+ </para>
+ </refsect1>
+
+ <refsect1 role="errors">
+ &reftitle.errors;
+
+ <para>
+ As of PHP 7.2.17 and 7.3.4, calling this method with a badly formatted
+ <parameter>time</parameter> will generate a <constant>E_WARNING</constant> message.
+ </para>
+ </refsect1>
+
+ <refsect1 role="changelog">
+ &reftitle.changelog;
+ <para>
+ <informaltable>
+ <tgroup cols="2">
+ <thead>
+ <row>
+ <entry>&Version;</entry>
+ <entry>&Description;</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry>7.2.17, 7.3.4</entry>
+ <entry>
+ Prior to PHP 7.2.17 and 7.3.4, passing a badly formatted <parameter>time</parameter>
+ would result in a <classname>DateInterval</classname> being created with 0 interval.
+ </entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </informaltable>
+ </para>
+ </refsect1>
</refentry>
<!-- Keep this comment at the end of the file
=> Put this change into your patches : https://edit.php.net/?project=php&action=putIntoMyPatches&idDB=94149
=> Delete this change: https://edit.php.net/?project=php&action=deleteThisChange&idDB=94149
------------------------------------------------------------------
Modified: en/reference/parallel/parallel/sync/wait.xml
By: [email protected] on 2019-09-20 10:25:09
===================================================================
--- en/reference/parallel/parallel/sync/wait.xml
+++ en/reference/parallel/parallel/sync/wait.xml
@@ -14,8 +14,44 @@
<void />
</methodsynopsis>
<para>
- Shall wait for notification on this synchronization object
+ Shall wait for notification on this synchronization object. This method should be called only inside <methodname>parallelSync::__invoke</methodname>
</para>
+ <example>
+ <title>Example showing correct way to use wait</title>
+ <programlisting role="php">
+<![CDATA[
+<?php
+$sync = new parallelSync;
+
+parallelrun(function() use($sync) {
+ $sync(function() use($sync) {
+ while ($sync->get() != 42) {
+ $sync->wait();
+ }
+
+ echo "Sync value is 42n";
+ });
+});
+
+echo "Sleep before syncn";
+
+usleep(mt_rand(100, 1000000));
+
+$sync(function() use($sync) {
+ $sync->set(42);
+ $sync->notify();
+});
+?>
+]]>
+ </programlisting>
+ &example.outputs;
+ <screen>
+<![CDATA[
+Sleep before sync
+Sync value is 42
+]]>
+ </screen>
+ </example>
</refsect1>
=> Put this change into your patches : https://edit.php.net/?project=php&action=putIntoMyPatches&idDB=95010
=> Delete this change: https://edit.php.net/?project=php&action=deleteThisChange&idDB=95010
------------------------------------------------------------------
Modified: en/reference/parallel/parallel/sync/notify.xml
By: [email protected] on 2019-09-20 10:25:39
===================================================================
--- en/reference/parallel/parallel/sync/notify.xml
+++ en/reference/parallel/parallel/sync/notify.xml
@@ -14,8 +14,44 @@
<methodparam choice="opt"><type>bool</type><parameter>all</parameter></methodparam>
</methodsynopsis>
<para>
- Shall notify one (by default) or all threads waiting on the synchronization object
+ Shall notify one (by default) or all threads waiting on the synchronization object. This method should be called only inside <methodname>parallelSync::__invoke</methodname>
</para>
+ <example>
+ <title>Example showing correct way to use notify</title>
+ <programlisting role="php">
+<![CDATA[
+<?php
+$sync = new parallelSync;
+
+parallelrun(function() use($sync) {
+ $sync(function() use($sync) {
+ while ($sync->get() != 42) {
+ $sync->wait();
+ }
+
+ echo "Sync value is 42n";
+ });
+});
+
+echo "Sleep before syncn";
+
+usleep(mt_rand(100, 1000000));
+
+$sync(function() use($sync) {
+ $sync->set(42);
+ $sync->notify();
+});
+?>
+]]>
+ </programlisting>
+ &example.outputs;
+ <screen>
+<![CDATA[
+Sleep before sync
+Sync value is 42
+]]>
+ </screen>
+ </example>
</refsect1>
=> Put this change into your patches : https://edit.php.net/?project=php&action=putIntoMyPatches&idDB=95011
=> Delete this change: https://edit.php.net/?project=php&action=deleteThisChange&idDB=95011
------------------------------------------------------------------
Modified: en/language/types/array.xml
By: Rupok on 2019-10-13 11:02:37
===================================================================
--- en/language/types/array.xml
+++ en/language/types/array.xml
@@ -4,7 +4,7 @@
<title>Arrays</title>
<para>
- An <type>array</type> in PHP is actually an ordered map. A map is a type that
+ An <type>array</type> in PHP is actually a map. A map is a type that
associates <emphasis>values</emphasis> to <emphasis>keys</emphasis>. This type
is optimized for several different uses; it can be treated as an array,
list (vector), hash table (an implementation of a map), dictionary,
=> Put this change into your patches : https://edit.php.net/?project=php&action=putIntoMyPatches&idDB=95445
=> Delete this change: https://edit.php.net/?project=php&action=deleteThisChange&idDB=95445
------------------------------------------------------------------
Modified: en/reference/reflection/reflectionclass/implementsinterface.xml
By: cmp on 2019-11-04 15:27:10
===================================================================
--- en/reference/reflection/reflectionclass/implementsinterface.xml
+++ en/reference/reflection/reflectionclass/implementsinterface.xml
@@ -11,7 +11,7 @@
&reftitle.description;
<methodsynopsis>
<modifier>public</modifier> <type>bool</type><methodname>ReflectionClass::implementsInterface</methodname>
- <methodparam><type>string</type><parameter>interface</parameter></methodparam>
+ <methodparam><type>mixed</type><parameter>interface</parameter></methodparam>
</methodsynopsis>
<para>
Checks whether it implements an interface.
@@ -26,7 +26,7 @@
<term><parameter>interface</parameter></term>
<listitem>
<para>
- The interface name.
+ The interface name or a <classname>ReflectionClass</classname> of the interface.
</para>
</listitem>
</varlistentry>
@@ -40,6 +40,13 @@
&return.success;
</para>
</refsect1>
+
+ <refsect1 role="errors">
+ &reftitle.errors;
+ <para>
+ Throws <classname>ReflectionException</classname> if the interface does not exist.
+ </para>
+ </refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
=> Put this change into your patches : https://edit.php.net/?project=php&action=putIntoMyPatches&idDB=96047
=> Delete this change: https://edit.php.net/?project=php&action=deleteThisChange&idDB=96047
------------------------------------------------------------------
Modified: en/reference/mysqli/mysqli/get-client-info.xml
By: Tom Van Looy on 2019-11-15 07:01:02
===================================================================
--- en/reference/mysqli/mysqli/get-client-info.xml
+++ en/reference/mysqli/mysqli/get-client-info.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
-<!-- $Revision: 348968 $ -->
+<!-- $Revision: 343950 $ -->
<refentry xml:id="mysqli.get-client-info" xmlns="http://docbook.org/ns/docbook">
<refnamediv>
<refname>mysqli::$client_info</refname>
@@ -19,7 +19,6 @@
<para>&style.procedural;</para>
<methodsynopsis>
<type>string</type><methodname>mysqli_get_client_info</methodname>
- <methodparam choice="opt"><type>mysqli</type><parameter>link</parameter><initializer>NULL</initializer></methodparam>
</methodsynopsis>
<para>
Returns a string that represents the MySQL client library version.
=> Put this change into your patches : https://edit.php.net/?project=php&action=putIntoMyPatches&idDB=96253
=> Delete this change: https://edit.php.net/?project=php&action=deleteThisChange&idDB=96253
------------------------------------------------------------------
Modified: en/reference/mysqli/mysqli/get-client-version.xml
By: Tom Van Looy on 2019-11-15 07:13:23
===================================================================
--- en/reference/mysqli/mysqli/get-client-version.xml
+++ en/reference/mysqli/mysqli/get-client-version.xml
@@ -14,7 +14,6 @@
<para>&style.procedural;</para>
<methodsynopsis>
<type>int</type><methodname>mysqli_get_client_version</methodname>
- <methodparam><type>mysqli</type><parameter>link</parameter></methodparam>
</methodsynopsis>
<para>
Returns client version number as an integer.
=> Put this change into your patches : https://edit.php.net/?project=php&action=putIntoMyPatches&idDB=96254
=> Delete this change: https://edit.php.net/?project=php&action=deleteThisChange&idDB=96254
------------------------------------------------------------------
Modified: en/reference/array/functions/array-diff.xml
By: anonymous on 2019-12-03 17:47:39
===================================================================
--- en/reference/array/functions/array-diff.xml
+++ en/reference/array/functions/array-diff.xml
@@ -17,7 +17,7 @@
<para>
Compares <parameter>array1</parameter> against one or more other arrays and
returns the values in <parameter>array1</parameter> that are not present in
- any of the other arrays.
+ any of the other arrays. Note that keys are preserved.
</para>
</refsect1>
=> Put this change into your patches : https://edit.php.net/?project=php&action=putIntoMyPatches&idDB=97142
=> Delete this change: https://edit.php.net/?project=php&action=deleteThisChange&idDB=97142
------------------------------------------------------------------
Modified: en/reference/array/functions/array-column.xml
By: anonymous on 2019-12-12 18:00:06
===================================================================
--- en/reference/array/functions/array-column.xml
+++ en/reference/array/functions/array-column.xml
@@ -69,7 +69,10 @@
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
- Returns an array of values representing a single column from the input array.
+ Returns an array of values representing a single column from the input array,
+ an array re-keyed by a single column from the input, or a combination of both.
+ The order of the keys and values in the result array correspond to those in
+ the input array.
</para>
</refsect1>
<refsect1 role="changelog">
=> Put this change into your patches : https://edit.php.net/?project=php&action=putIntoMyPatches&idDB=97460
=> Delete this change: https://edit.php.net/?project=php&action=deleteThisChange&idDB=97460
------------------------------------------------------------------
Modified: en/reference/curl/configure.xml
By: Chris Maiden on 2019-12-24 09:42:53
===================================================================
--- en/reference/curl/configure.xml
+++ en/reference/curl/configure.xml
@@ -3,29 +3,31 @@
<section xml:id="curl.installation" xmlns="http://docbook.org/ns/docbook">
&reftitle.install;
<para>
- To use PHP's cURL support you must also compile PHP <option
+ To use PHP's cURL support you must compile PHP <option
+ role="configure">--with-curl</option>.</para>
+ <para>Before PHP 7.4.0 it was possible to compile PHP <option
role="configure">--with-curl[=DIR]</option> where DIR is the
location of the directory containing the <filename>lib</filename> and <filename>include</filename>
directories. In the <filename>include</filename> directory there should be a folder
named <filename>curl</filename> which should contain the <filename>easy.h</filename> and
<filename>curl.h</filename> files. There should be a file named
- <filename>libcurl.a</filename> located in the <filename>lib</filename> directory. Before
- PHP 5.5.0 it was possible to configure PHP to use cURL for URL streams
+ <filename>libcurl.a</filename> located in the <filename>lib</filename> directory.</para>
+ <para>Before PHP 5.5.0 it was possible to configure PHP to use cURL for URL streams
<option role="configure">--with-curlwrappers</option>.
</para>
<note>
<title>Note to Win32 Users</title>
<simpara>
- In order to enable this module on a Windows environment,
- <filename>libeay32.dll</filename> and <filename>ssleay32.dll</filename>, or, as of OpenSSL 1.1
- <filename>libcrypto-*.dll</filename> and <filename>libssl-*.dll</filename>,
- must be present in your <envar>PATH</envar>.
- Also <filename>libssh2.dll</filename> must be present in your <envar>PATH</envar>.
+ In order to enable this module on a Windows environment,
+ <filename>libeay32.dll</filename> and <filename>ssleay32.dll</filename>, or, as of OpenSSL 1.1
+ <filename>libcrypto-*.dll</filename> and <filename>libssl-*.dll</filename>,
+ must be present in your <envar>PATH</envar>.
+ Also <filename>libssh2.dll</filename> must be present in your <envar>PATH</envar>.
</simpara>
<simpara>
- You don't need <filename>libcurl.dll</filename> from the cURL site.
+ You don't need <filename>libcurl.dll</filename> from the cURL site.
</simpara>
- </note>
+ </note>
</section>
<!-- Keep this comment at the end of the file
=> Put this change into your patches : https://edit.php.net/?project=php&action=putIntoMyPatches&idDB=97855
=> Delete this change: https://edit.php.net/?project=php&action=deleteThisChange&idDB=97855
------------------------------------------------------------------
Modified: en/reference/filesystem/functions/flock.xml
By: anonymous on 2020-01-06 21:20:58
===================================================================
--- en/reference/filesystem/functions/flock.xml
+++ en/reference/filesystem/functions/flock.xml
@@ -167,6 +167,7 @@
/* ... */
+flock($fp, LOCK_UN);
fclose($fp);
?>
]]>
=> Put this change into your patches : https://edit.php.net/?project=php&action=putIntoMyPatches&idDB=98057
=> Delete this change: https://edit.php.net/?project=php&action=deleteThisChange&idDB=98057
------------------------------------------------------------------
Modified: en/reference/spl/runtimeexception.xml
By: Jesse Rushlow on 2020-01-27 10:33:04
===================================================================
--- en/reference/spl/runtimeexception.xml
+++ en/reference/spl/runtimeexception.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
-<!-- $Revision: 349537 $ -->
+<!-- $Revision: 330314 $ -->
<phpdoc:exceptionref xml:id="class.runtimeexception"
xmlns:phpdoc="http://php.net/ns/phpdoc"
@@ -48,7 +48,7 @@
<xi:include xpointer="xmlns(db=http://docbook.org/ns/docbook) xpointer(id('class.runtimeexception')/db:refentry/db:refsect1[@role='description']/descendant::db:methodsynopsis[1])" />
-->
<classsynopsisinfo role="comment">&InheritedMethods;</classsynopsisinfo>
- <xi:include xpointer="xmlns(db=http://docbook.org/ns/docbook) xpointer(id('class.exception')/db:refentry/db:refsect1[@role='description']/descendant::db:constructorsynopsis[1])"><xi:fallback /></xi:include>
+ <xi:include xpointer="xmlns(db=http://docbook.org/ns/docbook) xpointer(id('class.exception')/db:refentry/db:refsect1[@role='description']/descendant::db:constructorsynopsis[1])" />
<xi:include xpointer="xmlns(db=http://docbook.org/ns/docbook) xpointer(id('class.exception')/db:refentry/db:refsect1[@role='description']/descendant::db:methodsynopsis[1])" />
</classsynopsis>
<!-- }}} -->
=> Put this change into your patches : https://edit.php.net/?project=php&action=putIntoMyPatches&idDB=98298
=> Delete this change: https://edit.php.net/?project=php&action=deleteThisChange&idDB=98298
------------------------------------------------------------------
Modified: en/reference/pcre/book.xml
By: anonymous on 2020-02-02 12:12:20
===================================================================
--- en/reference/pcre/book.xml
+++ en/reference/pcre/book.xml
@@ -26,7 +26,7 @@
Modifiers</link>.
</para>
<para>
- PHP also supports regular expressions using a POSIX-extended syntax
+ Prior to PHP 7.0.0, PHP also supported regular expressions using a POSIX-extended syntax
using the <link linkend="book.regex">POSIX-extended regex functions</link>.
</para>
<note>
=> Put this change into your patches : https://edit.php.net/?project=php&action=putIntoMyPatches&idDB=98493
=> Delete this change: https://edit.php.net/?project=php&action=deleteThisChange&idDB=98493
------------------------------------------------------------------
Modified: en/language/oop5/properties.xml
By: anonymous on 2020-02-08 16:14:03
===================================================================
--- en/language/oop5/properties.xml
+++ en/language/oop5/properties.xml
@@ -170,7 +170,48 @@
</screen>
</example>
</para>
+ <para>
+ A typed property must have a value before accessing it either by declaring it with a default value or thru assignment. Otherwise, an Error will be thrown when the property is first accessed.
+ <example>
+ <title>Example of uninitialized typed properties throwing errors</title>
+ <programlisting role="php">
+<![CDATA[
+<?php
+class User
+{
+ public int $id;
+ public string $name;
+
+ public function __construct(int $id)
+ {
+ $this->id = $id;
+ }
+}
+
+$user = new User(1234);
+echo "ID: " . $user->id;
+echo "n";
+echo "Name: " . $user->name; /// name was not initialized before access
+
+?>
+]]>
+ </programlisting>
+ &example.outputs;
+ <screen>
+<![CDATA[
+ID: 1234
+Fatal error: Uncaught Error: Typed property User::$name must not be accessed before initialization
+]]>
+ </screen>
+ </example>
+ </para>
+ <note>
+ <para>
+ Since the default value of a typed property is considered to be uninitialized, properties with nullable types have to have a value assigned as well. Therefore, the implicit value of a property with a nullable type is not NULL.
+ </para>
+ </note>
+
</sect1>
<!-- Keep this comment at the end of the file
=> Put this change into your patches : https://edit.php.net/?project=php&action=putIntoMyPatches&idDB=98719
=> Delete this change: https://edit.php.net/?project=php&action=deleteThisChange&idDB=98719
------------------------------------------------------------------
Modified: en/internals2/opcodes/recv.xml
By: anonymous on 2020-02-20 02:58:26
===================================================================
--- en/internals2/opcodes/recv.xml
+++ en/internals2/opcodes/recv.xml
@@ -8,7 +8,7 @@
<![CDATA[
<?php
/*
- * Receive a functoin argument of "argument-number" and store the argument value into a variable of "argument-number". (e.g. $1 for 1)
+ * Receive a function argument of "argument-number" and store the argument value into a variable of "argument-number". (e.g. $1 for 1)
* opcode number: 63
*/
function hello($a){}
=> Put this change into your patches : https://edit.php.net/?project=php&action=putIntoMyPatches&idDB=98872
=> Delete this change: https://edit.php.net/?project=php&action=deleteThisChange&idDB=98872
------------------------------------------------------------------
Modified: en/reference/mysqli/examples.xml
By: anonymous on 2020-03-12 12:05:40
===================================================================
--- en/reference/mysqli/examples.xml
+++ en/reference/mysqli/examples.xml
@@ -55,16 +55,43 @@
exit;
}
-// Perform an SQL query
-$sql = "SELECT actor_id, first_name, last_name FROM actor WHERE actor_id = $aid";
-if (!$result = $mysqli->query($sql)) {
- // Oh no! The query failed.
+// Prepare an SQL statement
+$sql = 'SELECT actor_id, first_name, last_name FROM actor WHERE actor_id = ?';
+if (!($stmt = $mysqli->prepare($sql))) {
+ // Oh no! The query failed.
+ echo "Sorry, the website is experiencing problems.";
+
+ // Again, do not do this on a public site, but we'll show you how
+ // to get the error information
+ echo "Error: Our statement could not be created and here is why: n";
+ echo "Statement: " . $sql . "n";
+ echo "Errno: " . $mysqli->errno . "n";
+ echo "Error: " . $mysqli->error . "n";
+ exit;
+}
+
+// Bind variables to the SQL statement
+if (!$stmt->bind_param('i', $aid)) {
+ // Oh no! The query failed.
+ echo "Sorry, the website is experiencing problems.";
+
+ // Again, do not do this on a public site, but we'll show you how
+ // to get the error information
+ echo "Error: Our statement could not bind parameters and here is why: n";
+ echo "Parameter: " . $aid . "n";
+ echo "Errno: " . $mysqli->errno . "n";
+ echo "Error: " . $mysqli->error . "n";
+ exit;
+}
+
+// Execute the statement
+if (!$stmt->execute()) {
+ // Oh no! The query failed.
echo "Sorry, the website is experiencing problems.";
// Again, do not do this on a public site, but we'll show you how
// to get the error information
echo "Error: Our query failed to execute and here is why: n";
- echo "Query: " . $sql . "n";
echo "Errno: " . $mysqli->errno . "n";
echo "Error: " . $mysqli->error . "n";
exit;
@@ -72,6 +99,8 @@
// Phew, we made it. We know our MySQL connection and query
// succeeded, but do we have a result?
+$result = $stmt->get_result();
+
if ($result->num_rows === 0) {
// Oh, no rows! Sometimes that's expected and okay, sometimes
// it is not. You decide. In this case, maybe actor_id was too
=> Put this change into your patches : https://edit.php.net/?project=php&action=putIntoMyPatches&idDB=99208
=> Delete this change: https://edit.php.net/?project=php&action=deleteThisChange&idDB=99208
------------------------------------------------------------------
Modified: en/reference/dom/domdocument/createelement.xml
By: anonymous on 2020-03-12 19:46:23
===================================================================
--- en/reference/dom/domdocument/createelement.xml
+++ en/reference/dom/domdocument/createelement.xml
@@ -54,6 +54,10 @@
Returns a new instance of class <classname>DOMElement</classname> or &false;
if an error occurred.
</para>
+ <para>
+ This will instead return the subclass if you have overridden it with
+ <method>DOMDocument::registerNodeClass</method>.
+ </para>
</refsect1>
<refsect1 role="errors">
&reftitle.errors;
=> Put this change into your patches : https://edit.php.net/?project=php&action=putIntoMyPatches&idDB=99214
=> Delete this change: https://edit.php.net/?project=php&action=deleteThisChange&idDB=99214
------------------------------------------------------------------
Modified: en/reference/filesystem/functions/ftell.xml
By: anonymous on 2020-03-20 09:12:21
===================================================================
--- en/reference/filesystem/functions/ftell.xml
+++ en/reference/filesystem/functions/ftell.xml
@@ -45,6 +45,9 @@
<para>
If an error occurs, returns &false;.
</para>
+ <para>
+ <function>ftell</function> only works with seekable files. For example, character devices, like standard input, is not seekable, so it will always return false.
+ </para>
&fs.file.32bit;
</refsect1>
=> Put this change into your patches : https://edit.php.net/?project=php&action=putIntoMyPatches&idDB=99433
=> Delete this change: https://edit.php.net/?project=php&action=deleteThisChange&idDB=99433
------------------------------------------------------------------
Modified: en/appendices/migration74/new-features.xml
By: Igor Santos on 2020-04-03 19:57:18
===================================================================
--- en/appendices/migration74/new-features.xml
+++ en/appendices/migration74/new-features.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
-<!-- $Revision: 349702 $ -->
+<!-- $Revision: 348891 $ -->
<sect1 xml:id="migration74.new-features" xmlns:xlink="http://www.w3.org/1999/xlink">
<title>New Features</title>
@@ -34,9 +34,9 @@
<title>Arrow functions</title>
<para>
- <link linkend="functions.arrow">Arrow functions</link> provide a
- shorthand syntax for defining functions
- with implicit by-value scope binding.
+ Arrow functions provide a shorthand syntax for defining one-line functions
+ with implicit by-value scope binding and no need of a <literal>return</literal>
+ keyword.
<informalexample>
<programlisting role="php">
=> Put this change into your patches : https://edit.php.net/?project=php&action=putIntoMyPatches&idDB=99953
=> Delete this change: https://edit.php.net/?project=php&action=deleteThisChange&idDB=99953
------------------------------------------------------------------
Modified: en/language/functions.xml
By: Igor Santos on 2020-04-03 21:08:14
===================================================================
--- en/language/functions.xml
+++ en/language/functions.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
-<!-- $Revision: 349700 $ -->
+<!-- $Revision: 347269 $ -->
<chapter xml:id="language.functions" xmlns="http://docbook.org/ns/docbook">
<title>Functions</title>
@@ -126,7 +126,7 @@
</simpara>
<note>
<simpara>
- Function names are case-insensitive for the ASCII characters <literal>A</literal> to <literal>Z</literal>, though it is usually good form
+ Function names are case-insensitive, though it is usually good form
to call functions as they appear in their declaration.
</simpara>
</note>
@@ -1426,8 +1426,7 @@
<programlisting role="php">
<![CDATA[
<?php
-$greet = function($name)
-{
+$greet = function($name) {
printf("Hello %srn", $name);
};
@@ -1441,7 +1440,7 @@
<simpara>
Closures may also inherit variables from the parent scope. Any such
variables must be passed to the <literal>use</literal> language construct.
- From PHP 7.1, these variables must not include &link.superglobals;,
+ As of PHP 7.1.0, these variables must not include &link.superglobals;,
<varname>$this</varname>, or variables with the same name as a parameter.
</simpara>
@@ -1624,7 +1623,7 @@
<sect2 xml:id="functions.anonymous-functions.static">
<title>Static anonymous functions</title>
<para>
- As of PHP 5.4, anonymous functions may be declared statically. This
+ As of PHP 5.4.0, anonymous functions may be declared statically. This
prevents them from having the current class automatically bound to
them. Objects may also not be bound to them at runtime.
</para>
@@ -1686,6 +1685,43 @@
</para>
</sect2>
+ <sect2 xml:id="functions.anonymous-functions.arrow">
+ <title>Arrow functions</title>
+ <para>
+ As of PHP 7.4.0, short anonymous functions may be declared with a shorter syntax.
+ Arrow functions do not need to manually inherit variables from the parent scope,
+ making them more concise. They only allow a single statement, and automatically
+ return it.
+ </para>
+ <para>
+ <example>
+ <title>Arrow function example</title>
+ <programlisting role="php">
+<![CDATA[
+<?php
+$cart = [
+ ['name' => 'Product 1', 'price' => 10, 'qty' => 1],
+ ['name' => 'Product 2', 'price' => 15, 'qty' => 3]
+];
+$tax = 0.05;
+
+array_walk($cart, fn(&$item) => $item['total'] = $item['price'] * $item['qty'] * (1 + $tax));
+$total = array_reduce($cart, fn($partial, $item) => $partial + $item['total'], 0);
+
+//standard equivalent anonymous functions, for comparison
+array_walk($cart, function(&$item) use ($tax) {
+ return $item['total'] = $item['price'] * $item['qty'] * (1 + $tax);
+});
+$total = array_reduce($cart, function ($partial, $item) {
+ return $partial + $item['total'];
+}, 0);
+?>
+]]>
+ </programlisting>
+ </example>
+ </para>
+ </sect2>
+
<sect2 role="changelog">
&reftitle.changelog;
<para>
@@ -1699,9 +1735,15 @@
</thead>
<tbody>
<row>
+ <entry>7.4.0</entry>
+ <entry>
+ Arrow functions become available.
+ </entry>
+ </row>
+ <row>
<entry>7.1.0</entry>
<entry>
- Anonymous functions may not close over &link.superglobals;,
+ Anonymous functions may not inherit &link.superglobals;,
<varname>$this</varname>, or any variable with the same name as a
parameter.
</entry>
@@ -1737,170 +1779,6 @@
</sect2>
</sect1>
- <sect1 xml:id="functions.arrow">
- <title>Arrow Functions</title>
-
- <simpara>
- Arrow functions were introduced in PHP 7.4 as a more concise syntax for
- <link linkend="functions.anonymous">anonymous functions</link>.
- </simpara>
- <simpara>
- Both anonymous functions and arrow functions are implemented using the
- <link linkend="class.closure"><classname>Closure</classname></link> class.
- </simpara>
-
- <simpara>
- Arrow functions have the basic form
- <code>fn (argument_list) => expr</code>.
- </simpara>
-
- <simpara>
- Arrow functions support the same features as
- <link linkend="functions.anonymous">anonymous functions</link>,
- except that using variables from the parent scope is always automatic.
- </simpara>
-
- <simpara>
- When a variable used in the expression is defined in the parent scope
- it will be implicitly captured by-value.
- In the following example, the functions <varname>$fn1</varname> and
- <varname>$fn2</varname> behave the same way.
- </simpara>
-
- <para>
- <example>
- <title>Arrow functions capture variables by value automatically</title>
- <programlisting role="php">
-<![CDATA[
-<?php
-
-$y = 1;
-
-$fn1 = fn($x) => $x + $y;
-// equivalent to using $y by value:
-$fn2 = function ($x) use ($y) {
- return $x + $y;
-};
-
-var_export($fn1(3));
-?>
-]]>
- </programlisting>
- &example.outputs;
- <screen>
-<![CDATA[
-4
-]]>
- </screen>
- </example>
- </para>
- <simpara>
- This also works if the arrow functions are nested:
- </simpara>
- <para>
- <example>
- <title>Arrow functions capture variables by value automatically, even when nested</title>
- <programlisting role="php">
-<![CDATA[
-<?php
-
-$z = 1;
-$fn = fn($x) => fn($y) => $x * $y + $z;
-// Outputs 51
-var_export($fn(5)(10));
-?>
-]]>
- </programlisting>
- </example>
- </para>
- <simpara>
- Similarly to anonymous functions,
- the arrow function syntax allows arbitrary function signatures,
- including parameter and return types, default values, variadics,
- as well as by-reference passing and returning.
- All of the following are valid examples of arrow functions:
- </simpara>
- <para>
- <example>
- <title>Examples of arrow functions</title>
- <programlisting role="php">
-<![CDATA[
-<?php
-
-fn(array $x) => $x;
-static fn(): int => $x;
-fn($x = 42) => $x;
-fn(&$x) => $x;
-fn&($x) => $x;
-fn($x, ...$rest) => $rest;
-
-?>
-]]>
- </programlisting>
- </example>
- </para>
- <simpara>
- Arrow functions use by-value variable binding.
- This is roughly equivalent to performing a <code>use($x)</code> for every
- variable <varname>$x</varname> used inside the arrow function.
- A by-value binding means that it is not possible to modify any values
- from the outer scope.
- <link linkend="functions.anonymous">Anonymous functions</link>
- can be used instead for by-ref bindings.
- </simpara>
- <para>
- <example>
- <title>Values from the outer scope cannot be modified by arrow functions</title>
- <programlisting role="php">
-<![CDATA[
-<?php
-
-$x = 1;
-$fn = fn() => $x++; // Has no effect
-$fn();
-var_export($x); // Outputs 1
-
-?>
-]]>
- </programlisting>
- </example>
- </para>
-
- <sect2 role="changelog">
- &reftitle.changelog;
- <para>
- <informaltable>
- <tgroup cols="2">
- <thead>
- <row>
- <entry>&Version;</entry>
- <entry>&Description;</entry>
- </row>
- </thead>
- <tbody>
- <row>
- <entry>7.4.0</entry>
- <entry>
- Arrow functions became available.
- </entry>
- </row>
- </tbody>
- </tgroup>
- </informaltable>
- </para>
- </sect2>
-
- <sect2 role="notes">
- &reftitle.notes;
- <note>
- <simpara>
- It is possible to use <function>func_num_args</function>,
- <function>func_get_arg</function>, and <function>func_get_args</function>
- from within an arrow function.
- </simpara>
- </note>
- </sect2>
- </sect1>
</chapter>
=> Put this change into your patches : https://edit.php.net/?project=php&action=putIntoMyPatches&idDB=99954
=> Delete this change: https://edit.php.net/?project=php&action=deleteThisChange&idDB=99954
------------------------------------------------------------------
--
https://edit.php.net/
This email is send automatically by the Php Docbook Online Editor.