From 6faf94065b10084efa237fcd78d68f5f729cb059 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Tue, 22 Feb 2022 15:17:49 +0100 Subject: fix gh#65 yaml_parse_url method not working using patch from https://github.com/php/pecl-file_formats-yaml/pull/66 --- php-pecl-yaml.spec | 14 ++++-- yaml-pr66.patch | 136 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 147 insertions(+), 3 deletions(-) create mode 100644 yaml-pr66.patch diff --git a/php-pecl-yaml.spec b/php-pecl-yaml.spec index f8c5217..20cdeb0 100644 --- a/php-pecl-yaml.spec +++ b/php-pecl-yaml.spec @@ -1,6 +1,6 @@ # remirepo spec file for php-pecl-yaml # -# Copyright (c) 2012-2018 Remi Collet +# Copyright (c) 2012-2022 Remi Collet # Fedora spec file for php-pecl-yaml # @@ -22,14 +22,16 @@ Summary: PHP Bindings for yaml Name: %{?sub_prefix}php-pecl-yaml Version: 2.0.4 -Release: 1%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}} +Release: 5%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}} License: MIT URL: http://pecl.php.net/package/yaml Source: http://pecl.php.net/get/%{pecl_name}-%{version}%{?prever}.tgz +Patch0: %{pecl_name}-pr66.patch + BuildRequires: %{?dtsprefix}gcc -BuildRequires: %{?scl_prefix}php-devel >= 7 +BuildRequires: %{?scl_prefix}php-devel >= 7.0 BuildRequires: %{?scl_prefix}php-pear BuildRequires: libyaml-devel @@ -92,6 +94,8 @@ sed -e 's/role="test"/role="src"/' \ -i package.xml cd NTS +%patch0 -p1 -b .pr66 + # Check upstream version (often broken) extver=$(sed -n '/#define PHP_YAML_VERSION/{s/.* "//;s/".*$//;p}' php_yaml.h) if test "x${extver}" != "x%{version}%{?prever}"; then @@ -239,6 +243,10 @@ fi %changelog +* Tue Feb 22 2022 Remi Collet - 2.0.4-2 +- fix gh#65 yaml_parse_url method not working using patch from + https://github.com/php/pecl-file_formats-yaml/pull/66 + * Sat Nov 24 2018 Remi Collet - 2.0.4-1 - update to 2.0.4 diff --git a/yaml-pr66.patch b/yaml-pr66.patch new file mode 100644 index 0000000..160deaa --- /dev/null +++ b/yaml-pr66.patch @@ -0,0 +1,136 @@ +From b3ba97abde6c503a305631649e8be01320078fb1 Mon Sep 17 00:00:00 2001 +From: Remi Collet +Date: Tue, 22 Feb 2022 11:57:38 +0100 +Subject: [PATCH 1/2] Fix #65 yaml_parse_url method not working + +--- + yaml.c | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +diff --git a/yaml.c b/yaml.c +index e06b145..4ca2cfe 100644 +--- a/yaml.c ++++ b/yaml.c +@@ -474,7 +474,6 @@ PHP_FUNCTION(yaml_parse_url) + + php_stream *stream = { 0 }; + zend_string *input; +- size_t size = 0; + + parser_state_t state; + zval yaml; +@@ -514,7 +513,7 @@ PHP_FUNCTION(yaml_parse_url) + } + + yaml_parser_initialize(&state.parser); +- yaml_parser_set_input_string(&state.parser, (unsigned char *)input, size); ++ yaml_parser_set_input_string(&state.parser, (unsigned char *)ZSTR_VAL(input), ZSTR_LEN(input)); + + if (pos < 0) { + php_yaml_read_all(&state, &ndocs, &yaml TSRMLS_CC); +From 2cd4463594345a8c844a86c33e3539f5a44f3156 Mon Sep 17 00:00:00 2001 +From: Remi Collet +Date: Tue, 22 Feb 2022 12:03:54 +0100 +Subject: [PATCH 2/2] add test for #65 + +--- + package.xml | 1 + + tests/yaml_parse_url_001.phpt | 89 +++++++++++++++++++++++++++++++++++ + 2 files changed, 90 insertions(+) + create mode 100644 tests/yaml_parse_url_001.phpt + +diff --git a/tests/yaml_parse_url_001.phpt b/tests/yaml_parse_url_001.phpt +new file mode 100644 +index 0000000..7c5efc4 +--- /dev/null ++++ b/tests/yaml_parse_url_001.phpt +@@ -0,0 +1,89 @@ ++--TEST-- ++yaml_parse_url - general ++--SKIPIF-- ++ ++--INI-- ++yaml.decode_timestamp=1 ++date.timezone=GMT ++--FILE-- ++ ++--EXPECT-- ++array(8) { ++ ["invoice"]=> ++ int(34843) ++ ["date"]=> ++ int(980208000) ++ ["bill-to"]=> ++ &array(3) { ++ ["given"]=> ++ string(5) "Chris" ++ ["family"]=> ++ string(6) "Dumars" ++ ["address"]=> ++ array(4) { ++ ["lines"]=> ++ string(27) "458 Walkman Dr. ++Suite #292 ++" ++ ["city"]=> ++ string(9) "Royal Oak" ++ ["state"]=> ++ string(2) "MI" ++ ["postal"]=> ++ int(48046) ++ } ++ } ++ ["ship-to"]=> ++ &array(3) { ++ ["given"]=> ++ string(5) "Chris" ++ ["family"]=> ++ string(6) "Dumars" ++ ["address"]=> ++ array(4) { ++ ["lines"]=> ++ string(27) "458 Walkman Dr. ++Suite #292 ++" ++ ["city"]=> ++ string(9) "Royal Oak" ++ ["state"]=> ++ string(2) "MI" ++ ["postal"]=> ++ int(48046) ++ } ++ } ++ ["product"]=> ++ array(2) { ++ [0]=> ++ array(4) { ++ ["sku"]=> ++ string(6) "BL394D" ++ ["quantity"]=> ++ int(4) ++ ["description"]=> ++ string(10) "Basketball" ++ ["price"]=> ++ float(450) ++ } ++ [1]=> ++ array(4) { ++ ["sku"]=> ++ string(7) "BL4438H" ++ ["quantity"]=> ++ int(1) ++ ["description"]=> ++ string(10) "Super Hoop" ++ ["price"]=> ++ float(2392) ++ } ++ } ++ ["tax"]=> ++ float(251.42) ++ ["total"]=> ++ float(4443.52) ++ ["comments"]=> ++ string(68) "Late afternoon is best. Backup contact is Nancy Billsmer @ 338-4338." ++} -- cgit