Gentoo Archives: gentoo-commits

From: Brian Evans <grknight@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-php/PEAR-XML_Parser/, dev-php/PEAR-XML_Parser/files/
Date: Tue, 11 Jan 2022 14:20:11
Message-Id: 1641910802.1627d312e5c119fbba0cd17bcde3f78adf1d1cb0.grknight@gentoo
1 commit: 1627d312e5c119fbba0cd17bcde3f78adf1d1cb0
2 Author: Brian Evans <grknight <AT> gentoo <DOT> org>
3 AuthorDate: Mon Jan 10 17:56:30 2022 +0000
4 Commit: Brian Evans <grknight <AT> gentoo <DOT> org>
5 CommitDate: Tue Jan 11 14:20:02 2022 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=1627d312
7
8 dev-php/PEAR-XML_Parser: Revbump on 1.3.8
9
10 Fix compatibility with PHP 8
11 Fix tests to modern standards
12
13 This will break scripts that use the startHandler but is necessary
14 to work with PHP 8. Packages in this repository will be updated.
15
16 Bug: https://bugs.gentoo.org/830811
17 Closes: https://bugs.gentoo.org/774795
18 Signed-off-by: Brian Evans <grknight <AT> gentoo.org>
19
20 .../PEAR-XML_Parser-1.3.8-r1.ebuild | 29 ++++++++++
21 .../files/XML_Parser-1.3.8-php8.patch | 66 ++++++++++++++++++++++
22 2 files changed, 95 insertions(+)
23
24 diff --git a/dev-php/PEAR-XML_Parser/PEAR-XML_Parser-1.3.8-r1.ebuild b/dev-php/PEAR-XML_Parser/PEAR-XML_Parser-1.3.8-r1.ebuild
25 new file mode 100644
26 index 000000000000..461ae05c1155
27 --- /dev/null
28 +++ b/dev-php/PEAR-XML_Parser/PEAR-XML_Parser-1.3.8-r1.ebuild
29 @@ -0,0 +1,29 @@
30 +# Copyright 1999-2022 Gentoo Authors
31 +# Distributed under the terms of the GNU General Public License v2
32 +
33 +EAPI=8
34 +
35 +inherit php-pear-r2
36 +
37 +DESCRIPTION="XML parsing class based on PHP's SAX parser"
38 +
39 +LICENSE="BSD"
40 +SLOT="0"
41 +KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~ppc ~ppc64 ~s390 ~sparc ~x86"
42 +IUSE=""
43 +# This is to match patch compatibility
44 +RDEPEND="!<dev-php/PEAR-XML_RSS-1.1.0-r2"
45 +
46 +PATCHES=( "${FILESDIR}/XML_Parser-1.3.8-php8.patch" )
47 +
48 +src_test() {
49 + peardev run-tests -r || die
50 +}
51 +
52 +pkg_postinst() {
53 + php-pear-r2_pkg_postinst
54 + elog 'This version includes a PHP 8 compatibilty patch for startHandler'
55 + elog 'which removes the pass-by-reference off of $attribs (third parameter).'
56 + elog 'This could break old scripts with recent versions until that override also'
57 + elog 'removes the pass-by-reference.'
58 +}
59
60 diff --git a/dev-php/PEAR-XML_Parser/files/XML_Parser-1.3.8-php8.patch b/dev-php/PEAR-XML_Parser/files/XML_Parser-1.3.8-php8.patch
61 new file mode 100644
62 index 000000000000..8115fd8d7297
63 --- /dev/null
64 +++ b/dev-php/PEAR-XML_Parser/files/XML_Parser-1.3.8-php8.patch
65 @@ -0,0 +1,66 @@
66 +diff -aruN a/XML/Parser.php b/XML/Parser.php
67 +--- a/XML/Parser.php 2022-01-10 11:32:08.624378884 -0500
68 ++++ b/XML/Parser.php 2022-01-10 11:47:09.581396869 -0500
69 +@@ -651,12 +651,12 @@
70 + *
71 + * @param mixed $xp ??
72 + * @param mixed $elem ??
73 +- * @param mixed &$attribs ??
74 ++ * @param mixed $attribs ??
75 + *
76 + * @return null
77 + * @abstract
78 + */
79 +- function startHandler($xp, $elem, &$attribs)
80 ++ function startHandler($xp, $elem, $attribs)
81 + {
82 + return null;
83 + }
84 +diff -aruN a/tests/001.phpt b/tests/001.phpt
85 +--- a/tests/001.phpt 2019-04-10 14:18:52.000000000 -0400
86 ++++ b/tests/001.phpt 2022-01-10 11:46:50.341458673 -0500
87 +@@ -13,10 +13,10 @@
88 + require_once "XML/Parser.php";
89 +
90 + class __TestParser1 extends XML_Parser {
91 +- function startHandler($xp, $element, &$attribs) {
92 ++ function startHandler($xp, $element, $attribs) {
93 + print "<$element";
94 + reset($attribs);
95 +- while (list($key, $val) = each($attribs)) {
96 ++ foreach ($attribs as $key => $val) {
97 + $enc = htmlentities($val);
98 + print " $key=\"$enc\"";
99 + }
100 +diff -aruN /tests/002.phpt /tests/002.phpt
101 +--- a/tests/002.phpt 2019-04-10 14:18:52.000000000 -0400
102 ++++ b/tests/002.phpt 2022-01-10 11:46:58.281433169 -0500
103 +@@ -13,10 +13,10 @@
104 + require_once "XML/Parser.php";
105 +
106 + class __TestParser2 extends XML_Parser {
107 +- function startHandler($xp, $element, &$attribs) {
108 ++ function startHandler($xp, $element, $attribs) {
109 + print "<$element";
110 + reset($attribs);
111 +- while (list($key, $val) = each($attribs)) {
112 ++ foreach ($attribs as $key => $val) {
113 + $enc = htmlentities($val);
114 + print " $key=\"$enc\"";
115 + }
116 +diff -aruN /tests/003.phpt /tests/003.phpt
117 +--- a/tests/003.phpt 2019-04-10 14:18:52.000000000 -0400
118 ++++ b/tests/003.phpt 2022-01-10 11:41:03.402573127 -0500
119 +@@ -13,10 +13,10 @@
120 + require_once "XML/Parser.php";
121 +
122 + class __TestParser3 extends XML_Parser {
123 +- function startHandler($xp, $element, &$attribs) {
124 ++ function startHandler($xp, $element, $attribs) {
125 + print "<$element";
126 + reset($attribs);
127 +- while (list($key, $val) = each($attribs)) {
128 ++ foreach ($attribs as $key => $val) {
129 + $enc = htmlentities($val);
130 + print " $key=\"$enc\"";
131 + }