forked from gentoo/gentoo
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
dev-php/PEAR-XML_Parser: Revbump on 1.3.8
Fix compatibility with PHP 8 Fix tests to modern standards This will break scripts that use the startHandler but is necessary to work with PHP 8. Packages in this repository will be updated. Bug: https://bugs.gentoo.org/830811 Closes: https://bugs.gentoo.org/774795 Signed-off-by: Brian Evans <[email protected]>
- Loading branch information
Brian Evans
committed
Jan 11, 2022
1 parent
3527319
commit 1627d31
Showing
2 changed files
with
95 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# Copyright 1999-2022 Gentoo Authors | ||
# Distributed under the terms of the GNU General Public License v2 | ||
|
||
EAPI=8 | ||
|
||
inherit php-pear-r2 | ||
|
||
DESCRIPTION="XML parsing class based on PHP's SAX parser" | ||
|
||
LICENSE="BSD" | ||
SLOT="0" | ||
KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~ppc ~ppc64 ~s390 ~sparc ~x86" | ||
IUSE="" | ||
# This is to match patch compatibility | ||
RDEPEND="!<dev-php/PEAR-XML_RSS-1.1.0-r2" | ||
|
||
PATCHES=( "${FILESDIR}/XML_Parser-1.3.8-php8.patch" ) | ||
|
||
src_test() { | ||
peardev run-tests -r || die | ||
} | ||
|
||
pkg_postinst() { | ||
php-pear-r2_pkg_postinst | ||
elog 'This version includes a PHP 8 compatibilty patch for startHandler' | ||
elog 'which removes the pass-by-reference off of $attribs (third parameter).' | ||
elog 'This could break old scripts with recent versions until that override also' | ||
elog 'removes the pass-by-reference.' | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
diff -aruN a/XML/Parser.php b/XML/Parser.php | ||
--- a/XML/Parser.php 2022-01-10 11:32:08.624378884 -0500 | ||
+++ b/XML/Parser.php 2022-01-10 11:47:09.581396869 -0500 | ||
@@ -651,12 +651,12 @@ | ||
* | ||
* @param mixed $xp ?? | ||
* @param mixed $elem ?? | ||
- * @param mixed &$attribs ?? | ||
+ * @param mixed $attribs ?? | ||
* | ||
* @return null | ||
* @abstract | ||
*/ | ||
- function startHandler($xp, $elem, &$attribs) | ||
+ function startHandler($xp, $elem, $attribs) | ||
{ | ||
return null; | ||
} | ||
diff -aruN a/tests/001.phpt b/tests/001.phpt | ||
--- a/tests/001.phpt 2019-04-10 14:18:52.000000000 -0400 | ||
+++ b/tests/001.phpt 2022-01-10 11:46:50.341458673 -0500 | ||
@@ -13,10 +13,10 @@ | ||
require_once "XML/Parser.php"; | ||
|
||
class __TestParser1 extends XML_Parser { | ||
- function startHandler($xp, $element, &$attribs) { | ||
+ function startHandler($xp, $element, $attribs) { | ||
print "<$element"; | ||
reset($attribs); | ||
- while (list($key, $val) = each($attribs)) { | ||
+ foreach ($attribs as $key => $val) { | ||
$enc = htmlentities($val); | ||
print " $key=\"$enc\""; | ||
} | ||
diff -aruN /tests/002.phpt /tests/002.phpt | ||
--- a/tests/002.phpt 2019-04-10 14:18:52.000000000 -0400 | ||
+++ b/tests/002.phpt 2022-01-10 11:46:58.281433169 -0500 | ||
@@ -13,10 +13,10 @@ | ||
require_once "XML/Parser.php"; | ||
|
||
class __TestParser2 extends XML_Parser { | ||
- function startHandler($xp, $element, &$attribs) { | ||
+ function startHandler($xp, $element, $attribs) { | ||
print "<$element"; | ||
reset($attribs); | ||
- while (list($key, $val) = each($attribs)) { | ||
+ foreach ($attribs as $key => $val) { | ||
$enc = htmlentities($val); | ||
print " $key=\"$enc\""; | ||
} | ||
diff -aruN /tests/003.phpt /tests/003.phpt | ||
--- a/tests/003.phpt 2019-04-10 14:18:52.000000000 -0400 | ||
+++ b/tests/003.phpt 2022-01-10 11:41:03.402573127 -0500 | ||
@@ -13,10 +13,10 @@ | ||
require_once "XML/Parser.php"; | ||
|
||
class __TestParser3 extends XML_Parser { | ||
- function startHandler($xp, $element, &$attribs) { | ||
+ function startHandler($xp, $element, $attribs) { | ||
print "<$element"; | ||
reset($attribs); | ||
- while (list($key, $val) = each($attribs)) { | ||
+ foreach ($attribs as $key => $val) { | ||
$enc = htmlentities($val); | ||
print " $key=\"$enc\""; | ||
} |