com doc/ja: Update note on print_r() and var_export () using output buffering: language-snippets.en t reference/var/functions/print-r.xml reference/var/funct ions/var-export.xml

[email protected] (Yoshinari Takaoka) Mon, 15 Feb 2021 21:35:53 +0000
Newsgroups php.doc.ja
Message-ID <[email protected]>
Commit:    bc13fd8ad70d48407730c7ae6cd0c9aab466103d
Author:    Yoshinari Takaoka <[email protected]>         Tue, 16 Feb 2021 06:35:53 +0900
Parents:   e4e8032e19bb613278ba92a506381cc83f6736d8
Branches:  master

Link:       http://git.php.net/?p=doc/ja.git;a=commitdiff;h=bc13fd8ad70d48407730c7ae6cd0c9aab466103d

Log:
Update note on print_r() and var_export() using output buffering

var_export stopped using output buffering to convert output to a string
long before php 7.0. See
https://github.com/php/php-src/blob/PHP-7.0/ext/standard/var.c#L564-L582

highlight_string/highlight_file are still using output buffering.

```
<?php
function my_buffer($value) {
    fprintf(STDERR, "var_export output: %s\n", var_export(array(), true));
    fprintf(STDERR, "print_r output: %s\n", print_r(array(), true));
    //fprintf(STDERR, "highlight_string output: %s\n", highlight_string('2+2', true));
    return $value;
}
ob_start('my_buffer');
echo "test";
$result = ob_get_clean();
echo "Result: $result\n";
```

Co-authored-by: Christoph M. Becker <[email protected]>

Closes GH-381.

Changed paths:
  M  language-snippets.ent
  M  reference/var/functions/print-r.xml
  M  reference/var/functions/var-export.xml


Diff:
diff --git a/language-snippets.ent b/language-snippets.ent
index e585ef6dcb..2e70ff7a60 100644
--- a/language-snippets.ent
+++ b/language-snippets.ent
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="utf-8"?>
 <!-- $Revision$ -->
-<!-- EN-Revision: 51105156aac67e5fcb0670aef84a05da3330d8fb Maintainer: takagi Status: working -->
+<!-- EN-Revision: 565d140248adf5507092461279dfaec75a1d1c0c Maintainer: takagi Status: working -->
 <!-- Credits: hirokawa,haruki,shimooka,mumumu -->
 
 <!ENTITY installation.enabled.disable 'この拡張モジュールはデフォルトで有効になっています。無効にしたい場合は、次のオプションを指定してコンパイルします。'>
@@ -116,6 +116,8 @@ PHP コミュニティは、ユーザーがこのディレクティブの設定
 <parameter>return</parameter> パラメータを使う場合、この関数は内部的に出力バッファリングを使います。
 そのため、<function>ob_start</function> コールバック関数の中では使えません。</para></note>'>
 
+<!ENTITY note.uses-ob-php70 '<note xmlns="http://docbook.org/ns/docbook"><para><parameter>return</parameter> パラメータを使う場合、かつ PHP 7.1.0 より前のバージョンでは、この関数は内部的な出力バッファリングを使っていました。この場合、<function>ob_start</function> のコールバック関数の中では使えません。</para></note>'>
+
 <!ENTITY note.filesystem-time-res '<note xmlns="http://docbook.org/ns/docbook"><para>時刻の精度は、
 ファイルシステムによって異なることがあります。</para></note>'>
 
diff --git a/reference/var/functions/print-r.xml b/reference/var/functions/print-r.xml
index df59810029..4a1ed7f24b 100644
--- a/reference/var/functions/print-r.xml
+++ b/reference/var/functions/print-r.xml
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="utf-8"?>
 <!-- $Revision$ -->
-<!-- EN-Revision: 0c9c2dd669fe9395eaa73d487fbd160f9057429a Maintainer: hirokawa Status: ready -->
+<!-- EN-Revision: 565d140248adf5507092461279dfaec75a1d1c0c Maintainer: hirokawa Status: ready -->
 <!-- CREDITS: shimooka -->
 <refentry xml:id="function.print-r" xmlns="http://docbook.org/ns/docbook">
  <refnamediv>
@@ -72,7 +72,7 @@
 
  <refsect1 role="notes">
   &reftitle.notes;
-  &note.uses-ob;
+  &note.uses-ob-php70;
  </refsect1>
 
  <refsect1 role="examples">
diff --git a/reference/var/functions/var-export.xml b/reference/var/functions/var-export.xml
index aaea83158e..b856b1656b 100644
--- a/reference/var/functions/var-export.xml
+++ b/reference/var/functions/var-export.xml
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="utf-8"?>
 <!-- $Revision$ -->
 <!-- splitted from ./en/functions/var.xml, last change in rev 1.6 -->
-<!-- EN-Revision: 0c9c2dd669fe9395eaa73d487fbd160f9057429a Maintainer: hirokawa Status: ready -->
+<!-- EN-Revision: 565d140248adf5507092461279dfaec75a1d1c0c Maintainer: hirokawa Status: ready -->
 <!-- CREDITS: shimooka,mumumu -->
 <refentry xml:id="function.var-export" xmlns="http://docbook.org/ns/docbook">
  <refnamediv>
@@ -61,7 +61,6 @@
 
  <refsect1 role="notes">
   &reftitle.notes;
-  &note.uses-ob;
  </refsect1>
 
  <refsect1 role="changelog">