[prev in list] [next in list] [prev in thread] [next in thread] 

List:       php-doc-cvs
Subject:    [DOC-CVS] [phd] master: Fix PHP 8.1 deprecations.
From:       Larry Garfield <noreply () php ! net>
Date:       2021-10-29 21:17:31
Message-ID: tFeuFWmw2USSMBQvf0ecKr6bCrh88We7P4HQilGM () main ! php ! net
[Download RAW message or body]

Author: Larry Garfield (Crell)
Pusher: salathe
Date: 2021-10-19T16:14:51-05:00

Commit: https://github.com/php/phd/commit/6c1af76a46934735a6f8f3f628e547ed3a6111ff
Raw diff: https://github.com/php/phd/commit/6c1af76a46934735a6f8f3f628e547ed3a6111ff.diff


Fix PHP 8.1 deprecations.

Changed paths:
  M  phpdotnet/phd/Index.php
  M  phpdotnet/phd/ObjectStorage.php
  M  phpdotnet/phd/Package/PHP/Web.php
  M  phpdotnet/phd/Package/PHP/XHTML.php
  M  phpdotnet/phd/Render.php


Diff:

diff --git a/phpdotnet/phd/Index.php b/phpdotnet/phd/Index.php
index c07cbe36..19d87feb 100644
--- a/phpdotnet/phd/Index.php
+++ b/phpdotnet/phd/Index.php
@@ -466,13 +466,13 @@ public function commit() {
                 }
             }
 
-            $this->db->exec('BEGIN TRANSACTION; '.join("", $this->commit).' \
COMMIT'); +            $this->db->exec('BEGIN TRANSACTION; '.implode("", \
$this->commit).' COMMIT');  $log = "";
             foreach($this->changelog as $id => $arr) {
                 foreach($arr as $entry) {
                     $log .= sprintf(
                         "INSERT INTO changelogs (membership, docbook_id, parent_id, \
                version, description) VALUES('%s', '%s', '%s', '%s', '%s');\n",
-                        $this->db->escapeString($entry[0]),
+                        $this->db->escapeString($entry[0] ?? ''),
                         $this->db->escapeString($id),
                         $this->db->escapeString($entry[1]),
                         $this->db->escapeString($entry[2]),
diff --git a/phpdotnet/phd/ObjectStorage.php b/phpdotnet/phd/ObjectStorage.php
index 7785d8c8..9284c22a 100644
--- a/phpdotnet/phd/ObjectStorage.php
+++ b/phpdotnet/phd/ObjectStorage.php
@@ -3,6 +3,8 @@
 
 class ObjectStorage extends \SplObjectStorage
 {
+    // @todo This is a bug, as attach() has a return type of void.
+    #[\ReturnTypeWillChange]
 	public function attach($obj, $inf = array()) {
 		if (!($obj instanceof Format)) {
 			throw new \InvalidArgumentException(
diff --git a/phpdotnet/phd/Package/PHP/Web.php b/phpdotnet/phd/Package/PHP/Web.php
index 96cde7e1..388cb267 100644
--- a/phpdotnet/phd/Package/PHP/Web.php
+++ b/phpdotnet/phd/Package/PHP/Web.php
@@ -41,7 +41,7 @@ public function appendData($data) {
             $this->pushFileStream($fp);
 
             $this->flags ^= Render::OPEN;
-        } else {
+        } elseif ($data) {
             $fp = $this->getFileStream();
             fwrite(end($fp), $data);
         }
diff --git a/phpdotnet/phd/Package/PHP/XHTML.php \
b/phpdotnet/phd/Package/PHP/XHTML.php index f316fb5d..4be89c46 100644
--- a/phpdotnet/phd/Package/PHP/XHTML.php
+++ b/phpdotnet/phd/Package/PHP/XHTML.php
@@ -501,7 +501,7 @@ public function format_methodsynopsis($open, $name, $attrs, \
$props) {  }
             }
 
-            $type = implode($this->type_separator, $types);
+            $type = implode($this->type_separator ?? '', $types);
             if (count($types) > 1) {
                 $type = '<span class="type">' . $type . '</span>';
             }
diff --git a/phpdotnet/phd/Render.php b/phpdotnet/phd/Render.php
index 39e84bc8..eab3c6d9 100644
--- a/phpdotnet/phd/Render.php
+++ b/phpdotnet/phd/Render.php
@@ -113,7 +113,7 @@ public function execute(Reader $r) { /* {{{ */
                         continue;
                     }
 
-                    if (strncmp($tag, "format_", 7) !== 0) {
+                    if (strncmp($tag ?? '', "format_", 7) !== 0) {
                         $data = $format->transformFromMap($open, $tag, $name, \
$attrs, $props);  } else {
                         $data = $format->{$tag}($open, $name, $attrs, $props);

-- 
PHP Documentation Commits Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic