From 8ba5798a401c68a49c2963324d6c4c9c50b16f26 Mon Sep 17 00:00:00 2001 From: r-a-y Date: Mon, 25 May 2020 22:42:45 -0700 Subject: [PATCH 1/4] Fix deprecated get_magic_quotes_gpc() notice. Replaced it with a strpos() check for a slash. --- Controllers/PF_Readability.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Controllers/PF_Readability.php b/Controllers/PF_Readability.php index 99e59f079..411deaf3d 100644 --- a/Controllers/PF_Readability.php +++ b/Controllers/PF_Readability.php @@ -28,8 +28,9 @@ public function get_readable_text( $args ) { $url = pressforward( 'controller.http_tools' )->resolve_full_url( $url ); // var_dump($url); die(); $descrip = rawurldecode( $descrip ); - if ( get_magic_quotes_gpc() ) { - $descrip = stripslashes( $descrip ); } + if ( false !== strpos( $descrip, '\\' ) ) { + $descrip = stripslashes( $descrip ); + } if ( $authorship == 'aggregation' ) { $aggregated = true; From 4428b08ecbd4c5d3b28591692ae25a801ef61452 Mon Sep 17 00:00:00 2001 From: r-a-y Date: Mon, 25 May 2020 22:52:25 -0700 Subject: [PATCH 2/4] Fix "Array to string conversion" notice. For the 'nominators' key, the $itemPart is a multi-dimensional array. We need to grab the keys of the array. --- includes/functions.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/includes/functions.php b/includes/functions.php index 9b3674dab..28e27b14c 100644 --- a/includes/functions.php +++ b/includes/functions.php @@ -422,6 +422,9 @@ function pf_prep_item_for_submit( $item ) { } if ( is_array( $itemPart ) ) { + if ( 'nominators' === $itemKey ) { + $itemPart = array_keys( $itemPart ); + } $itemPart = implode( ',',$itemPart ); } From b5f07ed9a37977a208cb1ed8b66d25765022bdfb Mon Sep 17 00:00:00 2001 From: r-a-y Date: Mon, 25 May 2020 22:58:04 -0700 Subject: [PATCH 3/4] Fix "preg_match(): Compilation failed: invalid range in character class at offset 4" warning. Hyphen needs to be escaped in preg_match(). --- Libraries/PFSimpleHtmlDom.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Libraries/PFSimpleHtmlDom.php b/Libraries/PFSimpleHtmlDom.php index 0b73d6b4a..f7c1d16ca 100644 --- a/Libraries/PFSimpleHtmlDom.php +++ b/Libraries/PFSimpleHtmlDom.php @@ -1073,7 +1073,7 @@ protected function read_tag() { return true; } - if ( ! preg_match( '/^[\w-:]+$/', $tag ) ) { + if ( ! preg_match( '/^[\w\-:]+$/', $tag ) ) { $node->_[ PF_HDOM_INFO_TEXT ] = '<' . $tag . $this->copy_until( '<>' ); if ( $this->char === '<' ) { $this->link_nodes( $node, false ); From fed17a028b9dfe37b0b14777dbb3c9fa99f4e35a Mon Sep 17 00:00:00 2001 From: r-a-y Date: Tue, 26 May 2020 13:53:03 -0700 Subject: [PATCH 4/4] Fix "preg_match_all(): Compilation failed: invalid range in character class at offset 4" warning. Hyphen needs to be escaped in preg_match_all(). --- Libraries/PFSimpleHtmlDom.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Libraries/PFSimpleHtmlDom.php b/Libraries/PFSimpleHtmlDom.php index f7c1d16ca..cfd26bb73 100644 --- a/Libraries/PFSimpleHtmlDom.php +++ b/Libraries/PFSimpleHtmlDom.php @@ -578,7 +578,7 @@ protected function parse_selector( $selector_string ) { // This implies that an html attribute specifier may start with an @ sign that is NOT captured by the expression. // farther study is required to determine of this should be documented or removed. // $pattern = "/([\w-:\*]*)(?:\#([\w-]+)|\.([\w-]+))?(?:\[@?(!?[\w-]+)(?:([!*^$]?=)[\"']?(.*?)[\"']?)?\])?([\/, ]+)/is"; - $pattern = "/([\w-:\*]*)(?:\#([\w-]+)|\.([\w-]+))?(?:\[@?(!?[\w-:]+)(?:([!*^$]?=)[\"']?(.*?)[\"']?)?\])?([\/, ]+)/is"; + $pattern = "/([\w\-:\*]*)(?:\#([\w\-]+)|\.([\w\-]+))?(?:\[@?(!?[\w\-:]+)(?:([!*^$]?=)[\"']?(.*?)[\"']?)?\])?([\/, ]+)/is"; preg_match_all( $pattern, trim( $selector_string ) . ' ', $matches, PREG_SET_ORDER ); if ( is_object( $debugObject ) ) {$debugObject->debugLog( 2, 'Matches Array: ', $matches );}