This is a resurrection of an old upstream bug report that was never resolved: https://bugs.php.net/bug.php?id=70027 dns_get_record() allows retrieving one or multiple DNS records of one or multiple types. However, when multiple DNS records are requested on FreeBSD, the entire function call fails if one of the requested records doesn't exist for the domain. The correct behavior (on other OS's) is to return those record types that do exist. Test command: --------------- php -r "var_dump(dns_get_record('www.google.com', DNS_A + DNS_CNAME));" Expected result: ---------------- array(1) { [0]=> array(5) { ["host"]=> string(14) "www.google.com" ["class"]=> string(2) "IN" ["ttl"]=> int(5) ["type"]=> string(1) "A" ["ip"]=> string(14) "142.250.73.196" } } Actual result: -------------- Warning: dns_get_record(): DNS Query failed in Command line code on line 1 bool(false) Will submit tested patch shortly - submitting this bug report now so PR# can be referenced in commit.
Created attachment 229369 [details] php74 patch Patch tested on Freebsd 12.2-RELEASE. Will also submit upstream.
This bug also affects php73 and php80. I have tested patches for these also. Should they each get their own bugs? Or include them all here?
(In reply to fsbruva from comment #2) include them here. Don't forget to bump PORTREVISION.
Have you opened an issue upstream? Do you have a link?
(In reply to Mikael Urankar from comment #4) Upstream bug reported, and I will make a github PR to php-src shortly. https://bugs.php.net/bug.php?id=81618
Created attachment 229454 [details] php74 patch (rev2) (In reply to Mikael Urankar from comment #3) Updated patch to bump PORTREVISION for php74.
Created attachment 229455 [details] php73 patch Patch for php73
Created attachment 229456 [details] php80 patch
(In reply to fsbruva from comment #5) Is it this PR? https://github.com/php/php-src/pull/7650/files
(In reply to Mikael Urankar from comment #9) No - this is the upstream PR. The php.net patching scheme is to merge the PR to the oldest affected branch (7.3 in this case), and the merge it forward as needed. https://github.com/php/php-src/pull/7655/files
Upstream PR has been merged to 7.3, 7.4, 8.0 and master.
Thank you for all your work :) Since it is already in upstream: is there any priority in merging the patches right now into the ports? Or can we just wait for the next release? Best, Torsten
(In reply to Torsten Zuehlsdorff from comment #12) No problem, happy to tilt at windmills :) I suppose the churn of this fix is probably not worth it for most users, but I think waiting for 7.4.27 is too long. Assuming 7.5.26 is released within the next week or so and includes this fix, we can close this bug as OBE. If for some reason 7.4.26 doesn't include it, then you could add the patch files at the same time as DISTVERSION. Thoughts? Matt
Sounds like a good plan. If the next release does not contain the fix, i will add the patches :)
(In reply to Torsten Zuehlsdorff from comment #14) Welp.... 7.4.26 has been released, and this fix didn't make it in. Do you want me to re-submit my patches against the latest releases? Or try them out and see if there are problems?
I will integrate your patches in the update. I am currently running the build-tests. :) But i am going to ignore the PHP 7.3 patch. 7.3 is security-only maintenance and even this will end in 15 days. So i don't want to add the patch there.
A commit in branch main references this bug: URL: https://cgit.FreeBSD.org/ports/commit/?id=11d48ddebb9c0951afead066cdb578270182010a commit 11d48ddebb9c0951afead066cdb578270182010a Author: Torsten Zuehlsdorff <tz@FreeBSD.org> AuthorDate: 2021-11-20 19:27:05 +0000 Commit: Torsten Zuehlsdorff <tz@FreeBSD.org> CommitDate: 2021-11-20 19:31:39 +0000 lang/php74: Upgrade from 7.4.25 to 7.4.26 Core: Fixed bug #81518 (Header injection via default_mimetype / default_charset). Date: Fixed bug #81500 (Interval serialization regression since 7.3.14 / 7.4.2). MBString: Fixed bug #76167 (mbstring may use pointer from some previous request). MySQLi: Fixed bug #81494 (Stopped unbuffered query does not throw error). PCRE: Fixed bug #81424 (PCRE2 10.35 JIT performance regression). Streams: Fixed bug #54340 (Memory corruption with user_filter). XML: Fixed bug #79971 (special character is breaking the path in xml function). (CVE-2021-21707) Also include a patch to fix issue 259725: dns_get_record fails when requested record doesn't exist PR: 259725 Reported by: fsbruva@yahoo.com Sponsored by: Bounce Experts devel/php74-intl/Makefile | 1 - devel/php74-intl/files/patch-icu70 (gone) | 38 ---------------------- lang/php74/Makefile | 2 +- lang/php74/distinfo | 6 ++-- lang/php74/files/patch-ext_standard_dns.c (new) | 21 ++++++++++++ .../files/patch-ext_standard_php__dns.h (new) | 24 ++++++++++++++ 6 files changed, 49 insertions(+), 43 deletions(-)
A commit in branch main references this bug: URL: https://cgit.FreeBSD.org/ports/commit/?id=91fd937f88cae37d468aa1973dd88232c2fb498c commit 91fd937f88cae37d468aa1973dd88232c2fb498c Author: Torsten Zuehlsdorff <tz@FreeBSD.org> AuthorDate: 2021-11-20 19:29:48 +0000 Commit: Torsten Zuehlsdorff <tz@FreeBSD.org> CommitDate: 2021-11-20 19:31:39 +0000 lang/php80: Upgrade from 8.0.12 to 8.0.13 Core: Fixed bug #81518 (Header injection via default_mimetype / default_charset). Date: Fixed bug #81500 (Interval serialization regression since 7.3.14 / 7.4.2). DBA: Fixed bug #81588 (TokyoCabinet driver leaks memory). MBString: Fixed bug #76167 (mbstring may use pointer from some previous request). Opcache: Fixed bug #81512 (Unexpected behavior with arrays and JIT). PCRE: Fixed bug #81424 (PCRE2 10.35 JIT performance regression). XML: Fixed bug #79971 (special character is breaking the path in xml function). (CVE-2021-21707) XMLReader: Fixed bug #81521 (XMLReader::getParserProperty may throw with a valid property). Also include a patch to fix issue 259725: dns_get_record fails when requested record doesn't exist PR: 259725 Reported by: fsbruva@yahoo.com Sponsored by: Bounce Experts devel/php80-intl/Makefile | 1 - devel/php80-intl/files/patch-icu70 (gone) | 38 ---------------------- lang/php80/Makefile | 2 +- lang/php80/distinfo | 6 ++-- lang/php80/files/patch-ext_standard_dns.c (new) | 21 ++++++++++++ .../files/patch-ext_standard_php__dns.h (new) | 24 ++++++++++++++ 6 files changed, 49 insertions(+), 43 deletions(-)
A commit in branch 2021Q4 references this bug: URL: https://cgit.FreeBSD.org/ports/commit/?id=4c9d8131c3838f83e3db7c5f7eb072cda9b38837 commit 4c9d8131c3838f83e3db7c5f7eb072cda9b38837 Author: Torsten Zuehlsdorff <tz@FreeBSD.org> AuthorDate: 2021-11-20 19:29:48 +0000 Commit: Torsten Zuehlsdorff <tz@FreeBSD.org> CommitDate: 2021-11-20 19:32:25 +0000 lang/php80: Upgrade from 8.0.12 to 8.0.13 Core: Fixed bug #81518 (Header injection via default_mimetype / default_charset). Date: Fixed bug #81500 (Interval serialization regression since 7.3.14 / 7.4.2). DBA: Fixed bug #81588 (TokyoCabinet driver leaks memory). MBString: Fixed bug #76167 (mbstring may use pointer from some previous request). Opcache: Fixed bug #81512 (Unexpected behavior with arrays and JIT). PCRE: Fixed bug #81424 (PCRE2 10.35 JIT performance regression). XML: Fixed bug #79971 (special character is breaking the path in xml function). (CVE-2021-21707) XMLReader: Fixed bug #81521 (XMLReader::getParserProperty may throw with a valid property). Also include a patch to fix issue 259725: dns_get_record fails when requested record doesn't exist PR: 259725 Reported by: fsbruva@yahoo.com Sponsored by: Bounce Experts (cherry picked from commit 91fd937f88cae37d468aa1973dd88232c2fb498c) lang/php80/Makefile | 2 +- lang/php80/distinfo | 6 +++--- lang/php80/files/patch-ext_standard_dns.c (new) | 21 +++++++++++++++++++ .../files/patch-ext_standard_php__dns.h (new) | 24 ++++++++++++++++++++++ 4 files changed, 49 insertions(+), 4 deletions(-)
A commit in branch 2021Q4 references this bug: URL: https://cgit.FreeBSD.org/ports/commit/?id=d2b83425d5824041c4d1f609e8a8ebec765e0def commit d2b83425d5824041c4d1f609e8a8ebec765e0def Author: Torsten Zuehlsdorff <tz@FreeBSD.org> AuthorDate: 2021-11-20 19:27:05 +0000 Commit: Torsten Zuehlsdorff <tz@FreeBSD.org> CommitDate: 2021-11-20 19:32:18 +0000 lang/php74: Upgrade from 7.4.25 to 7.4.26 Core: Fixed bug #81518 (Header injection via default_mimetype / default_charset). Date: Fixed bug #81500 (Interval serialization regression since 7.3.14 / 7.4.2). MBString: Fixed bug #76167 (mbstring may use pointer from some previous request). MySQLi: Fixed bug #81494 (Stopped unbuffered query does not throw error). PCRE: Fixed bug #81424 (PCRE2 10.35 JIT performance regression). Streams: Fixed bug #54340 (Memory corruption with user_filter). XML: Fixed bug #79971 (special character is breaking the path in xml function). (CVE-2021-21707) Also include a patch to fix issue 259725: dns_get_record fails when requested record doesn't exist PR: 259725 Reported by: fsbruva@yahoo.com Sponsored by: Bounce Experts (cherry picked from commit 11d48ddebb9c0951afead066cdb578270182010a) lang/php74/Makefile | 2 +- lang/php74/distinfo | 6 +++--- lang/php74/files/patch-ext_standard_dns.c (new) | 21 +++++++++++++++++++ .../files/patch-ext_standard_php__dns.h (new) | 24 ++++++++++++++++++++++ 4 files changed, 49 insertions(+), 4 deletions(-)
Comitted! Thank you! :)
Looks like my upstream patch made it into 7.4.27RC1, 8.0.14RC1 and 8.1.1RC1. So when those updates get released, the port patch can get dropped.