Skip to content

Commit

Permalink
Sync mysqli_real_connect and mb_strimwidth (php#822)
Browse files Browse the repository at this point in the history
  • Loading branch information
sy-records authored Dec 3, 2023
1 parent 350d01c commit 994c833
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 13 deletions.
18 changes: 15 additions & 3 deletions reference/mbstring/functions/mb-strimwidth.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<!-- EN-Revision: 64f2f1c70d2f42507d9c624e09dcf486ceca7be5 Maintainer: daijie Status: ready -->
<!-- CREDITS: mowangjuanzi -->
<!-- EN-Revision: ca4b9d11a25fc9f8dde7561c504ed466ed1d6c63 Maintainer: daijie Status: ready -->
<!-- CREDITS: mowangjuanzi, Luffy -->
<refentry xml:id="function.mb-strimwidth" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>mb_strimwidth</refname>
Expand Down Expand Up @@ -49,7 +49,12 @@
<term><parameter>width</parameter></term>
<listitem>
<para>
所需修剪的宽度。负数的宽度是从字符串结尾处统计的。
所需修剪的宽度。如果指定负宽度,则从字符串末尾开始计数。
<note>
<para>
从 PHP 8.3.0 起,传递负宽度已被弃用。
</para>
</note>
</para>
</listitem>
</varlistentry>
Expand Down Expand Up @@ -90,6 +95,13 @@
</row>
</thead>
<tbody>
<row>
<entry>8.3.0</entry>
<entry>
将负的 <parameter>width</parameter> 传递给
<function>mb_strimwidth</function> 现已废弃。
</entry>
</row>
&mbstring.changelog.encoding-nullable;
<row>
<entry>7.1.0</entry>
Expand Down
20 changes: 10 additions & 10 deletions reference/mysqli/mysqli/real-connect.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<!-- EN-Revision: 2d77c9fe145f74663128006eb71662b0c44e8987 Maintainer: 谢毅斌 Status: ready -->
<!-- CREDITS: mowangjuanzi -->
<!-- EN-Revision: ae0dfad417adaba25669003c69024aa96b71dddf Maintainer: 谢毅斌 Status: ready -->
<!-- CREDITS: mowangjuanzi, Luffy -->
<refentry xml:id="mysqli.real-connect" xmlns="http://docbook.org/ns/docbook">
<refnamediv>
<refname>mysqli::real_connect</refname>
Expand Down Expand Up @@ -43,8 +43,8 @@
<itemizedlist>
<listitem>
<para>
<function>mysqli_real_connect</function> 需要一个有效的对象,这个对象由
<function>mysqli_init</function> 创建
<function>mysqli_real_connect</function> 需要一个 <classname>mysqli</classname> 对象的实例。
这可以通过调用无参数的 <methodname>mysqli::__construct</methodname> 或 <function>mysqli_connect</function> 获得
</para>
</listitem>
<listitem>
Expand Down Expand Up @@ -226,9 +226,9 @@
<![CDATA[
<?php
$mysqli = mysqli_init();
$mysqli = new mysqli();
if (!$mysqli) {
die('mysqli_init failed');
die('mysqli connection failed');
}
if (!$mysqli->options(MYSQLI_INIT_COMMAND, 'SET AUTOCOMMIT = 0')) {
Expand Down Expand Up @@ -257,7 +257,8 @@ $mysqli->close();
class foo_mysqli extends mysqli {
public function __construct($host, $user, $pass, $db) {
parent::init();
// 必须直接调用父构造函数,否则将产生 E_FATAL 错误
parent::__construct();
if (!parent::options(MYSQLI_INIT_COMMAND, 'SET AUTOCOMMIT = 0')) {
die('Setting MYSQLI_INIT_COMMAND failed');
Expand Down Expand Up @@ -287,9 +288,9 @@ $db->close();
<![CDATA[
<?php
$link = mysqli_init();
$link = mysqli_connect();
if (!$link) {
die('mysqli_init failed');
die('mysqli_connect failed');
}
if (!mysqli_options($link, MYSQLI_INIT_COMMAND, 'SET AUTOCOMMIT = 0')) {
Expand Down Expand Up @@ -330,7 +331,6 @@ Success... MySQL host info: localhost via TCP/IP
<para>
<simplelist>
<member><function>mysqli_connect</function></member>
<member><function>mysqli_init</function></member>
<member><function>mysqli_options</function></member>
<member><function>mysqli_ssl_set</function></member>
<member><function>mysqli_close</function></member>
Expand Down

0 comments on commit 994c833

Please sign in to comment.