diff options
author | Max Rees <maxcrees@me.com> | 2020-03-25 07:26:01 +0000 |
---|---|---|
committer | Max Rees <maxcrees@me.com> | 2020-04-05 12:22:26 +0000 |
commit | 1898956d4fb51404a527e909230781848a9d3118 (patch) | |
tree | 809d21e6b0aa650fd626123b63b43b5cf64bf133 /user/php7 | |
parent | 7f8d4d642ad643f553e0fe74c0d48d59c81d178c (diff) | |
download | packages-1898956d4fb51404a527e909230781848a9d3118.tar.gz packages-1898956d4fb51404a527e909230781848a9d3118.tar.bz2 packages-1898956d4fb51404a527e909230781848a9d3118.tar.xz packages-1898956d4fb51404a527e909230781848a9d3118.zip |
user/php7: bump to 7.4.4
* Use system libgd
* Use system oniguruma
* Upstream has migrated from pcre to pcre2
* Drop comments about extensions that aren't being built (imap, recode,
sodium, tidy)
* Drop php7-wddx (has been removed from core upstream)
* Drop php7-litespeed (I don't think anyone uses this)
* Pin subpackage versions to main package
* Fix _extensions_by_load_order so all extensions are tested
* This increases the test suite size from ~ 9000 to ~ 15000
* Add additional API/ABI checks from Fedora
Diffstat (limited to 'user/php7')
-rw-r--r-- | user/php7/APKBUILD | 437 | ||||
-rw-r--r-- | user/php7/disabled-tests.list | 87 | ||||
-rw-r--r-- | user/php7/enchant-2.patch | 64 | ||||
-rw-r--r-- | user/php7/fix-tests-devserver.patch | 23 | ||||
-rw-r--r-- | user/php7/getsockopt.patch | 37 | ||||
-rw-r--r-- | user/php7/install-pear.patch | 7 | ||||
-rw-r--r-- | user/php7/no-max-ent-size.patch | 257 | ||||
-rw-r--r-- | user/php7/pwbuflen.patch | 15 | ||||
-rw-r--r-- | user/php7/test-fixes.patch | 71 | ||||
-rw-r--r-- | user/php7/zend_bool.patch | 19 | ||||
-rw-r--r-- | user/php7/zip-glob-pathc.patch | 15 |
11 files changed, 733 insertions, 299 deletions
diff --git a/user/php7/APKBUILD b/user/php7/APKBUILD index a8ef4976e..581104a84 100644 --- a/user/php7/APKBUILD +++ b/user/php7/APKBUILD @@ -8,10 +8,10 @@ # ----------+---------+------------------------+--------- # bcmath | LGPL2 | ext/bcmath/libbcmath | used # date | MIT | ext/date/lib | used -# gd | BSD | ext/gd/libgd | used +# gd | BSD | ext/gd/libgd | not used # file | BSD | ext/fileinfo/libmagic | used # libmbfl | LGPLv2 | ext/mbstring/libmbfl | used -# oniguruma | BSD | ext/mbstring/oniguruma | used +# oniguruma | BSD | ext/mbstring/oniguruma | not used # pcre | BSD | ext/pcre/pcrelib | not used # sqlite3 | Public | ext/sqlite3/libsqlite | not used # libzip | BSD | ext/zip/lib | not used @@ -25,63 +25,68 @@ pkgname=php7 _pkgname=php -pkgver=7.2.21 +pkgver=7.4.4 pkgrel=0 -_apiver=20170718 +_apiver=20190902 +_zendver=20190902 +_pdover=20170320 pkgdesc="The PHP7 language runtime engine" url="https://php.net/" arch="all" license="PHP-3.01 AND Zend-2.0 AND Custom:TSRM AND LGPL-2.1+ AND MIT AND Beerware AND Public-Domain AND BSD-3-Clause AND Apache-1.0 AND PostgreSQL AND BSD-2-Clause AND Zlib AND BSD-4-Clause" depends="" depends_dev="$pkgname=$pkgver-r$pkgrel autoconf icu-dev libedit-dev libxml2-dev - pcre-dev zlib-dev" + pcre2-dev zlib-dev" makedepends="autoconf apache-httpd-dev aspell-dev + automake bison bzip2-dev + cmd:which curl-dev db-dev enchant-dev freetds-dev - freetype-dev gdbm-dev gettext-tiny gmp-dev icu-dev krb5-dev libedit-dev + libgd-dev libical-dev - libjpeg-turbo-dev - libpng-dev openssl-dev - libwebp-dev libxml2-dev - libxpm-dev libxslt-dev libzip-dev net-snmp-dev + oniguruma-dev openldap-dev - pcre-dev + pcre2-dev postgresql-dev re2c sqlite-dev unixodbc-dev - zlib-dev" -subpackages="$pkgname-dev $pkgname-doc $pkgname-apache $pkgname-phpdbg - $pkgname-embed $pkgname-litespeed $pkgname-cgi $pkgname-fpm + zlib-dev + " +subpackages="$pkgname-dev $pkgname-doc $pkgname-phpdbg + $pkgname-embed $pkgname-cgi $pkgname-fpm $pkgname-apache $pkgname-pear::noarch $pkgname-dbg" source="https://www.php.net/distributions/$_pkgname-$pkgver.tar.bz2 $_pkgname-fpm.initd $_pkgname-fpm.logrotate $_pkgname-module.conf disabled-tests.list - install-pear.patch + enchant-2.patch fpm-paths.patch - allow-build-recode-and-imap-together.patch - fix-tests-devserver.patch - pwbuflen.patch - enchant-2.patch" + getsockopt.patch + install-pear.patch + no-max-ent-size.patch + test-fixes.patch + zend_bool.patch + zip-glob-pathc.patch + " builddir="$srcdir/$_pkgname-$pkgver" _libdir="/usr/lib/$_pkgname" _extension_dir="$_libdir/modules" @@ -105,137 +110,133 @@ _extension_confd="/etc/$_pkgname/conf.d" # 7.2.21-r0: # - CVE-2019-11041 # - CVE-2019-11042 - -# Usage: add_ext [with|enable] name [extension dependencies...] [configure options...] -add_ext() { - local ext="$1" +# 7.4.4-r0: +# - CVE-2019-11043 +# - CVE-2019-11045 +# - CVE-2019-11046 +# - CVE-2019-11047 +# - CVE-2019-11050 +# - CVE-2019-13224 +# - CVE-2020-7059 +# - CVE-2020-7060 +# - CVE-2020-7062 +# - CVE-2020-7063 +# - CVE-2020-7064 +# - CVE-2020-7066 + +# Usage: _add_ext [with|enable] name [extension dependencies...] [configure options...] +_add_ext() { + _ext="$1" shift - # add_ext [with|enable] name -> --[with|enable]-name=shared - if [ "$ext" = "with" ] || [ "$ext" = "enable" ]; then - _configure_ext_opts="$_configure_ext_opts --$ext-$1=shared" - ext="$1" + # _add_ext [with|enable] name -> --[with|enable]-name=shared + case "$_ext" in + with|enable) + _configure_ext_opts="$_configure_ext_opts --$_ext-$1=shared" + _ext="$1" shift - fi + ;; + esac - case "$ext" in - phar) subpackages="$subpackages $pkgname-$ext:$ext";; - *) subpackages="$subpackages $pkgname-$ext:_extension";; + case "$_ext" in + phar) subpackages="$subpackages $pkgname-$_ext:$_ext";; + *) subpackages="$subpackages $pkgname-$_ext:_extension";; esac - _extensions="$_extensions $ext" + _extensions="$_extensions $_ext" - local opt - local prev - for opt in $@; do - case "$opt" in + for _opt; do + case "$_opt" in -*) # Add more configure options - _configure_ext_opts="$_configure_ext_opts $opt" + _configure_ext_opts="$_configure_ext_opts $_opt" ;; license:*) # Add custom license - opt="$(printf '%s' "${opt#license:}" | sed 's/:/ AND /g')" - eval "_licenses_$ext='$opt'" + _opt="$(printf '%s' "${_opt#license:}" | sed 's/:/ AND /g')" + eval "_licenses_$_ext='$_opt'" ;; *) # Add dependencies - prev="$(eval echo \$_deps_$ext)" - eval "_deps_$ext='$prev $opt'" + eval "_deps_$_ext=\"\$_deps_$_ext $_opt\"" ;; - esac + esac done } -enable_ext() { add_ext enable $@; } -with_ext() { add_ext with $@; } +_enable_ext() { _add_ext enable "$@"; } +_with_ext() { _add_ext with "$@"; } -enable_ext 'bcmath' \ +_enable_ext bcmath \ license:LGPL-2.0+:PHP-3.01 -with_ext 'bz2' -enable_ext 'calendar' -enable_ext 'ctype' -with_ext 'curl' -enable_ext 'dba' \ +_with_ext bz2 +_enable_ext calendar +_enable_ext ctype +_with_ext curl +_enable_ext dba \ --with-db4 \ --with-dbmaker=shared \ --with-gdbm -enable_ext 'dom' -with_ext 'enchant' -enable_ext 'exif' mbstring -enable_ext 'fileinfo' \ +_enable_ext dom +_with_ext enchant +_enable_ext exif mbstring +_enable_ext fileinfo \ license:PHP-3.0:BSD-2-Clause:BSD-3-Clause:Public-Domain -enable_ext 'ftp' -with_ext 'gd' \ - --with-freetype-dir=/usr \ - --disable-gd-jis-conv \ - --with-jpeg-dir=/usr \ - --with-png-dir=/usr \ - --with-webp-dir=/usr \ - --with-xpm-dir=/usr -with_ext 'gettext' -with_ext 'gmp' -with_ext 'iconv' -# Needs makedepeneds=imap-dev -#with_ext 'imap' \ -# --with-imap-ssl -enable_ext 'intl' -enable_ext 'json' -with_ext 'ldap' \ +_enable_ext ftp +_enable_ext gd \ + --with-external-gd +_with_ext gettext +_with_ext gmp +_with_ext iconv +_enable_ext intl +_enable_ext json +_with_ext ldap \ --with-ldap-sasl -enable_ext 'mbstring' \ +_enable_ext mbstring \ license:PHP-3.01:OLDAP-2.8:BSD-2-Clause:Public-Domain:LGPL-2.0-only:LGPL-2.1-only -add_ext 'mysqli' mysqlnd openssl \ +_add_ext mysqli mysqlnd openssl \ --with-mysqli=shared,mysqlnd \ --with-mysql-sock=/run/mysqld/mysqld.sock -enable_ext 'mysqlnd' openssl -add_ext 'odbc' \ +_enable_ext mysqlnd openssl +_add_ext odbc \ --with-unixODBC=shared,/usr -enable_ext 'opcache' -with_ext 'openssl' \ +_enable_ext opcache +_with_ext openssl \ --with-system-ciphers \ --with-kerberos -enable_ext 'pcntl' -enable_ext 'pdo' -add_ext 'pdo_dblib' pdo \ +_enable_ext pcntl +_enable_ext pdo +_add_ext pdo_dblib pdo \ --with-pdo-dblib=shared -add_ext 'pdo_mysql' pdo mysqlnd \ +_add_ext pdo_mysql pdo mysqlnd \ --with-pdo-mysql=shared,mysqlnd -add_ext 'pdo_odbc' pdo \ +_add_ext pdo_odbc pdo \ license:PHP-3.0 \ --with-pdo-odbc=shared,unixODBC,/usr -add_ext 'pdo_pgsql' pdo \ +_add_ext pdo_pgsql pdo \ --with-pdo-pgsql=shared -add_ext 'pdo_sqlite' pdo \ +_add_ext pdo_sqlite pdo \ --with-pdo-sqlite=shared,/usr -with_ext 'pgsql' -enable_ext 'phar' -enable_ext 'posix' -with_ext 'pspell' -# Needs makedepends=recode-dev -#with_ext 'recode' -enable_ext 'session' -enable_ext 'shmop' -enable_ext 'simplexml' -with_ext 'snmp' -enable_ext 'soap' \ +_with_ext pgsql +_enable_ext phar +_enable_ext posix +_with_ext pspell +_enable_ext session +_enable_ext shmop +_enable_ext simplexml +_with_ext snmp +_enable_ext soap \ license:PHP-3.01:PHP-2.02 -# Needs makedepends=libsodium-dev -#with_ext 'sodium' -enable_ext 'sockets' -add_ext 'sqlite3' \ +_enable_ext sockets +_add_ext sqlite3 \ --with-sqlite3=shared,/usr -enable_ext 'sysvmsg' -enable_ext 'sysvsem' -enable_ext 'sysvshm' -# Needs makedepends=tidyhtml-dev -#with_ext 'tidy' -enable_ext 'tokenizer' -enable_ext 'wddx' xml -enable_ext 'xml' -enable_ext 'xmlreader' dom -with_ext 'xmlrpc' xml -enable_ext 'xmlwriter' -with_ext 'xsl' dom -enable_ext 'zip' \ - --with-libzip=/usr +_enable_ext sysvmsg +_enable_ext sysvsem +_enable_ext sysvshm +_enable_ext tokenizer +_enable_ext xml +_enable_ext xmlreader dom +_with_ext xmlrpc xml +_enable_ext xmlwriter +_with_ext xsl dom +_with_ext zip # secfixes: # 7.2.5-r0: @@ -248,13 +249,23 @@ enable_ext 'zip' \ prepare() { default_prepare - update_config_sub - local vapi="$(sed -n '/#define PHP_API_VERSION/{s/.* //;p}' main/php.h)" - if [ "$vapi" != "$_apiver" ]; then - error "Upstreram API version is now $vapi. Expecting $_apiver" - error "After updating _apiver, all 3rd-party extensions must be rebuilt." - return 1 + _vapi="$(sed -n '/#define PHP_API_VERSION/{s/.* //;p}' main/php.h)" + if [ "$_vapi" != "$_apiver" ]; then + error "Upstream API version $_vapi != $_apiver" + die "All third-party extensions must be rebuilt" + fi + + _zapi="$(sed -n '/#define ZEND_MODULE_API_NO/{s/^[^0-9]*//;p;}' Zend/zend_modules.h)" + if [ "$_zapi" != "$_zendver" ]; then + error "Upstream Zend API version $_zapi != $_zendver" + die "All third-party extensions must be rebuilt" + fi + + _papi="$(sed -n '/#define PDO_DRIVER_API/{s/.*[ ]//;p}' ext/pdo/php_pdo_driver.h)" + if [ "$_papi" != "$_pdover" ]; then + error "Upstream PDO API version $_papi != $_pdover" + die "All third-party extensions must be rebuilt" fi # https://bugs.php.net/63362 - Not needed but installed headers. @@ -271,21 +282,17 @@ prepare() { # Fix some bogus permissions. find . -name '*.[ch]' -exec chmod 644 {} + - # XXX: Delete failing tests. - sed -n '/^[^#]/p' "$srcdir/disabled-tests.list" | while read item; do - rm $item + # XXX: Disable failing tests. + sed -n '/^[^#]/p' "$srcdir/disabled-tests.list" | while read _test; do + mv "$_test" "${_test}d" done autoconf } -# Notes: -# * gd-jis-conv breaks any non-latin font rendering (vakartel). -# * libxml cannot be build as shared. -# * Doesn't work with system-provided onigurama, some tests fail (invalid code -# point); probably because bundled onigurama is version 5.x, but we have 6.x. _build() { - EXTENSION_DIR=$_extension_dir PCRE_INCDIR="/usr/include" ./configure \ + # libxml cannot be build as shared. + EXTENSION_DIR="$_extension_dir" ./configure \ --build=$CBUILD \ --host=$CHOST \ --prefix=/usr \ @@ -301,56 +308,61 @@ _build() { --with-config-file-path=/etc/$_pkgname \ --with-config-file-scan-dir=$_extension_confd \ --disable-short-tags \ - --with-icu-dir=/usr \ --with-libedit \ --without-readline \ - --enable-libxml \ - --with-libxml-dir=/usr \ - --with-pcre-regex=/ \ + --with-external-pcre \ --with-zlib \ --with-zlib-dir=/usr \ $_configure_ext_opts \ - $@ + "$@" make } build() { - # phpdbg - _build --enable-phpdbg \ - --enable-phpdbg-webhelper \ - --disable-cgi \ - --disable-cli + export CFLAGS="$CFLAGS -fno-strict-aliasing -Wno-pointer-sign" # apache-httpd module - _build --disable-phpdbg \ + _build --disable-fpm \ + --disable-embed \ + --disable-phpdbg \ --disable-cgi \ --disable-cli \ --with-apxs2 mv libs/libphp7.so sapi/apache2handler/mod_php.so - # cgi, cli, fpm, embed, litespeed - _build --disable-phpdbg \ - --enable-fpm \ - --enable-embed \ - --with-litespeed + _build --enable-fpm=yes \ + --enable-embed=yes \ + --enable-phpdbg=yes \ + --enable-phpdbg-webhelper=yes } check() { # PHP is so stupid that it's not able to resolve dependencies # between extensions and load them in correct order, so we must # help it... - # opcache is Zend extension, it's handled specially in Makefile - local php_modules="$(_extensions_by_load_order \ - | grep -vx opcache \ - | xargs -n 1 printf "'$builddir/modules/%s.la' ")" - sed -i "/^PHP_TEST_SHARED_EXTENSIONS/,/extension=/ \ - s|in \$(PHP_MODULES)\"*|in $php_modules|" Makefile + # + # * opcache is Zend extension, it's handled specially in Makefile + # * skip pdo_dblib since it slowly tries to connect to nonexistent + # * ditto snmp + + cat > php-check.ini <<-EOF + extension_dir=$builddir/modules + $(_extensions_by_load_order \ + | grep -vxe opcache -e pdo_dblib -e snmp \ + | sed -e 's/^/extension=/' -e 's/$/.so/') + EOF + + # Note: We use the combination of PHPRC=... and + # PHP_MODULES=(nothing) so we can set the module load order + # correctly. Cf. test-fixes.patch NO_INTERACTION=1 REPORT_EXIT_STATUS=1 \ SKIP_SLOW_TESTS=1 SKIP_ONLINE_TESTS=1 TEST_TIMEOUT=10 \ + TEST_PHP_ARGS="-j$JOBS -W test.log" \ TZ= LANG= LC_ALL= \ - make test + PHPRC="$builddir"/php-check.ini \ + make test PHP_MODULES= echo 'NOTE: We have skipped quite a lot tests, see disabled-tests.list.' } @@ -376,14 +388,13 @@ doc() { cd "$builddir" mkdir -p "$subpkgdir/usr/share/doc/$_pkgname" - cp CODING_STANDARDS CREDITS EXTENSIONS INSTALL LICENSE NEWS \ - README* UPGRADING* \ + cp EXTENSIONS LICENSE NEWS README* UPGRADING* \ "$subpkgdir/usr/share/doc/$_pkgname/" } apache() { pkgdesc="PHP7 Module for apache-httpd" - depends="$pkgname apache-httpd" + depends="$pkgname=$pkgver-r$pkgrel apache-httpd" install -D -m 755 "$builddir"/sapi/apache2handler/mod_php.so \ "$subpkgdir"/usr/libexec/apache2/mod_php.so @@ -393,37 +404,26 @@ apache() { phpdbg() { pkgdesc="Interactive PHP7 debugger" - #depends="$pkgname" ? - install -Dm755 "$builddir"/sapi/phpdbg/phpdbg \ - "$subpkgdir"/usr/bin/phpdbg + _mv "$pkgdir"/usr/bin/phpdbg "$subpkgdir"/usr/bin/ } embed() { pkgdesc="PHP7 Embedded Library" - #depends="$pkgname" ? _mv "$pkgdir"/usr/lib/libphp*.so "$subpkgdir"/usr/lib/ } -litespeed() { - pkgdesc="PHP7 LiteSpeed SAPI" - #depends="$pkgname" ? - - mkdir -p "$subpkgdir"/usr/bin - mv "$pkgdir"/usr/bin/lsphp "$subpkgdir"/usr/bin -} - cgi() { pkgdesc="PHP7 Common Gateway Interface" - depends="$pkgname" + depends="$pkgname=$pkgver-r$pkgrel" _mv "$pkgdir"/usr/bin/php-cgi "$subpkgdir"/usr/bin/ } fpm() { pkgdesc="PHP7 FastCGI Process Manager" - depends="$pkgname" + depends="$pkgname=$pkgver-r$pkgrel" cd "$pkgdir" _mv var "$subpkgdir"/ @@ -431,9 +431,9 @@ fpm() { _mv usr/sbin "$subpkgdir"/usr/ _mv etc/$_pkgname/php-fpm* "$subpkgdir"/etc/$_pkgname/ - local file; for file in php-fpm.conf php-fpm.d/www.conf; do - mv "$subpkgdir"/etc/$_pkgname/$file.default \ - "$subpkgdir"/etc/$_pkgname/$file + for _file in php-fpm.conf php-fpm.d/www.conf; do + mv "$subpkgdir/etc/$_pkgname/$_file.default" \ + "$subpkgdir/etc/$_pkgname/$_file" done install -D -m 755 "$srcdir"/$_pkgname-fpm.initd \ @@ -447,7 +447,7 @@ fpm() { pear() { pkgdesc="PHP7 Extension and Application Repository" - depends="$pkgname $pkgname-xml" + depends="$pkgname=$pkgver-r$pkgrel $pkgname-xml=$pkgver-r$pkgrel" cd "$pkgdir" # pecl needs xml extension and since we build it as shared, it must be @@ -455,8 +455,8 @@ pear() { sed -i 's/\$INCARG/& -d extension=xml.so/' usr/bin/pecl mkdir -p "$subpkgdir"/usr/bin - local file; for file in pecl pear peardev; do - mv usr/bin/$file "$subpkgdir"/usr/bin/$file + for _file in pecl pear peardev; do + mv "usr/bin/$_file" "$subpkgdir/usr/bin/$_file" done _mv etc/php/pear.conf "$subpkgdir"/etc/php/ @@ -475,73 +475,70 @@ phar() { } _extension() { - local ext="${subpkgname#$pkgname-}" - local extdesc="$(head -n1 "$builddir"/ext/$ext/CREDITS 2>/dev/null ||:)" - depends="$pkgname" - local dep; for dep in $(eval echo \$_deps_$ext); do - depends="$depends $pkgname-$dep" + _ext="${subpkgname#$pkgname-}" + + depends="$pkgname=$pkgver-r$pkgrel" + for _dep in $(eval echo \$_deps_$_ext); do + depends="$depends $pkgname-$_dep=$pkgver-r$pkgrel" done - pkgdesc="PHP7 extension: ${extdesc:-$ext}" - if [ -n "$(eval echo \$_licenses_$ext)" ]; then - license="$(eval echo \$_licenses_$ext)" - fi - local load_order=$(_extension_load_order "$ext") + pkgdesc="$(head -n1 "$builddir/_ext/$_ext/CREDITS" 2>/dev/null ||:)" + pkgdesc="PHP7 extension: ${pkgdesc:-$_ext}" - # extension prefix - local prefix= - [ "$ext" = "opcache" ] && prefix="zend_" + if [ -n "$(eval echo \$_licenses_$_ext)" ]; then + license="$(eval echo \$_licenses_$_ext)" + fi - _mv "$pkgdir"/$_extension_dir/$ext.so \ - "$subpkgdir"/$_extension_dir/ + _mv "$pkgdir/$_extension_dir/$_ext.so" \ + "$subpkgdir/$_extension_dir/" - mkdir -p "$subpkgdir"/$_extension_confd - echo "${prefix}extension=$ext.so" \ - > "$subpkgdir"/$_extension_confd/$(printf %02d $load_order)_$ext.ini + _load_order="$(printf %02d "$(_extension_load_order "$_ext")")" + case "$_ext" in + opcache) _prefix=zend_;; + *) _prefix=;; + esac + mkdir -p "$subpkgdir/$_extension_confd" + cat > "$subpkgdir/$_extension_confd/${_load_order}_$_ext.ini" <<-EOF + ${_prefix}extension=$_ext.so + EOF } # Prints a load order (0-based integer) for the given extension name. Extension # with lower load order should be loaded before exts with higher load order. -# It's based on number of dependencies of the extension (with exception for -# "imap"), which is flawed, but simple and good enough for now. +# It's based on number of dependencies of the extension which is flawed, +# but simple and good enough for now. _extension_load_order() { - local ext="$1" - local deps="$(eval echo \$_deps_$ext)" - - case "$ext" in - # This must be loaded after recode, even though it does - # not depend on it. - imap) echo 1;; - # depends=$pkgname - phar) echo 1;; - *) echo "$deps" | wc -w;; + _ext="$1" + case "$_ext" in + # depends=$pkgname + phar) echo 1;; + *) echo "$(eval echo \$_deps_$_ext)" | wc -w;; esac } # Prints $_extensions sorted by load order and name. _extensions_by_load_order() { - local deps list ext - - for ext in $_extensions; do - list="$list $(_extension_load_order $ext);$ext" - done - printf '%s\n' $list | sort -t ';' -k 1 | sed -E 's/\d+;//' + for _ext in $_extensions; do + printf '%s\n' "$(_extension_load_order $_ext);$_ext" + done | sort -t ';' -k 1 | sed -E 's/[0-9]+;//' } _mv() { - local dest; for dest; do true; done # get last argument - mkdir -p "$dest" - mv $@ + for _dest; do true; done # get last argument + mkdir -p "$_dest" + mv "$@" } -sha512sums="b234305f04bd621d355450ba38b34558a5b08403571749ac3b04ffa60d7639e847750109bef09a14f616110ba175b970d68cbae0d0b671c2dfeac6917f12f21d php-7.2.21.tar.bz2 +sha512sums="5676023858ffbef4997c2ed99ce1689de2b56d09a0925b8fc6527d56e7f6031b380e433e417e44f84196e713d84c16b33212ed6d116b5c347d1d60586288c248 php-7.4.4.tar.bz2 cb3ba48fbd412f12d98ef1f88b509b40bc4ca44a16779a06d43e4db3cb8d24d54404b9e11ca941b5339af8d3281ca9c8ea3ba5ced4339f91fb40608b5ce9a647 php-fpm.initd 01d4ba3ef104ea378eb0e8cbb7bdee3fdf65e4bd6865eb3bc6c0dc4af31c2d52887abdf0150b5ef984b877860285a3b1af84b11ffebb5b8b722ea9faf83edfeb php-fpm.logrotate a7f9ba5e11652fd1cb9e756c3269269a95de083ecb5be936a85c7a09c1396db9088e0251c6a643c40235c0e776fce2a471e5c7f5a033b85c7d3b3110c2b39e48 php-module.conf -b1008eabc86fcff88336fe2961e3229c159c930a05d97359136c381c5c1cc572a33110308a3e5ef5e31c60327f76c9ef02b375cd2ea8ff9caa7deeddc216f4ce disabled-tests.list -f1177cbf6b1f44402f421c3d317aab1a2a40d0b1209c11519c1158df337c8945f3a313d689c939768584f3e4edbe52e8bd6103fb6777462326a9d94e8ab1f505 install-pear.patch +587057aaf93feec2936e2851dbb42ba78310fc012e340d90c58a8912437a8b6a15585895490c31ac31cf36969ea1f2999993c5ca42031c378f31fb83d361fd73 disabled-tests.list +2fb8e1dce0e71a968c53869b01369bb681e4e043e87d342cd96cb7c09e8c2ca0aad9752d8e0781de54488bee54717ba0de5ef9eba28f16cd7e6b914e03c53bc6 enchant-2.patch a77dd3bdf9dc7a0f2c06ff3e7c425d062bbaa29902c17402ce98701dc99499be863ad543aa5e6a7d1c249702d6afb193398dd3199ae58e42b32b95d434fb1883 fpm-paths.patch -f8ecae241a90cbc3e98aa4deb3d5d35ef555f51380e29f4e182a8060dffeb84be74f030a14c6b452668471030d78964f52795ca74275db05543ccad20ef1f2cc allow-build-recode-and-imap-together.patch -f8bb322e56df79dd9f391737fb8737945cc730b14c7dc2ae8688979c565a9b97f5f2a12c9fcd0d8124624a9d09bd10228147d9e999bb94909bbe249f0a50646c fix-tests-devserver.patch -8e538063d872f6770a57cdb844226a771ccda3d387dd1f199bb08c274b94fbe12ec0ef6df75c32071f308cb8f4ab51b91b520c7c2ed687adf96d0d322788e463 pwbuflen.patch -03de56676449ddc1ba1fc9c4fee2b2ed620cd1a8ce52d288c91b42e081182871ade55c8dbbe1c8286bc4eadcd92d497a62ac7b689ea8d6b1bcb5eb25225595c4 enchant-2.patch" +821bf6fde83302e7613429a61066e2bd3ca4e998dcb7c11e39f4ae84829056537501b47a051e1feba752f72d98644b9a214633db9ccb16d137d3242d145acfe0 getsockopt.patch +951fa8445c20513aa48bf7c7d773c6b4012322e7e7592c13d965758e761b9898c484f0dbc5ae565c05787e6ab868769c97c71504624b10c9570e1d4214f75b10 install-pear.patch +5fd358dfd660901c8ffdaffe0bce398ab020f8c1beb89e26ba1b21646212fe132927d52ae088220d0b9c53017cfc67f4c9b88f7602df61d36eba5768ce94e355 no-max-ent-size.patch +9160e5c6b8bf2d87299f38421caf498519eb42243118570754a5764b5e682c546309548e76df6163df49e841ff51fb07e50fadeed1687da5d73dec1810c393ee test-fixes.patch +0cd6b8739533511c0d1edcb1ecff4d8d21a6b51d21f77c382645cf31d1645eeb2ebd80e2720557ceefa58f538385e097402bdc50e613dc7699bd8f033aefa543 zend_bool.patch +1b22dfa547bd1e14e065966f5268adda771c4ad039b83acee30772cd95f0f0b1a320d75fc6ab71a0bc6ca5ce04d58d9f410767c4fae4d5e16537393c78439f21 zip-glob-pathc.patch" diff --git a/user/php7/disabled-tests.list b/user/php7/disabled-tests.list index 10117801e..fc1386e2e 100644 --- a/user/php7/disabled-tests.list +++ b/user/php7/disabled-tests.list @@ -1,18 +1,14 @@ # Dumb failures # Expects permissions on /etc to be 40755 ext/standard/tests/file/006_error.phpt -# session_start() missing - needs session.so -# Test manually using the following: -# test.ini contains "extension=./modules/session.so" -# TEST_PHP_EXECUTABLE=sapi/cli/php sapi/cli/php run-tests.php -c test.ini $f -Zend/tests/unset_cv05.phpt -Zend/tests/unset_cv06.phpt # Tests undefined behavior (integer underflow or overflow) Zend/tests/dval_to_lval_32.phpt Zend/tests/int_underflow_32bit.phpt ext/date/tests/bug53437_var3.phpt ext/date/tests/bug53437_var5.phpt ext/date/tests/bug53437_var6.phpt +ext/exif/tests/bug79046.phpt +ext/exif/tests/float_cast_overflow.phpt # General glibc/musl incompatibility related failures # stdout printed in wrong order @@ -25,10 +21,17 @@ ext/standard/tests/strings/007.phpt ext/standard/tests/file/popen_pclose_error.phpt # "Address in use" instead of "Address already in use" printed for EADDRINUSE sapi/fpm/tests/socket-ipv4-fallback.phpt +# strerror differences +ext/sockets/tests/socket_strerror.phpt +ext/sockets/tests/socket_create_pair-wrongparams.phpt +# socket_addrinfo_explain has unexpected ai_canonname member +ext/sockets/tests/socket_addrinfo_explain.phpt # locale related failures # LC_NUMERIC unsupported ext/standard/tests/strings/sprintf_f_3.phpt +ext/intl/tests/bug67052.phpt +ext/json/tests/bug41403.phpt tests/lang/034.phpt tests/lang/bug30638.phpt # LC_ALL unsupported @@ -43,8 +46,10 @@ ext/standard/tests/strings/htmlentities03.phpt ext/standard/tests/strings/htmlentities04.phpt ext/standard/tests/strings/htmlentities15.phpt ext/standard/tests/strings/strtoupper.phpt +ext/fileinfo/tests/bug74170.phpt # LC_MONETARY unsupported ext/standard/tests/strings/moneyformat.phpt +ext/soap/tests/bugs/bug39815.phpt # locale: command not found ext/standard/tests/strings/setlocale_basic1.phpt ext/standard/tests/strings/setlocale_basic2.phpt @@ -53,6 +58,17 @@ ext/standard/tests/strings/setlocale_variation1.phpt ext/standard/tests/strings/setlocale_variation2.phpt # setlocale allows "en_US.invalid" ext/standard/tests/strings/setlocale_error.phpt +# bind_textdomain_codeset is a stub +ext/gettext/tests/gettext_bind_textdomain_codeset-retval.phpt +# //IGNORE +ext/iconv/tests/bug48147.phpt +ext/iconv/tests/bug76249.phpt +# //TRANSLIT +ext/iconv/tests/iconv_basic_001.phpt +# misc musl iconv incompatibilities +ext/iconv/tests/bug52211.phpt +ext/iconv/tests/eucjp2iso2022jp.phpt +ext/iconv/tests/iconv_mime_encode.phpt # strftime and strptime related failures # strftime %Z (timezone abbreviation) returns a single space @@ -91,5 +107,64 @@ ext/standard/tests/crypt/des_fallback_invalid_salt.phpt #sapi/fpm/tests/015.phpt # Times out on builders but runs fine manually +ext/zlib/tests/bug67724.phpt ext/zlib/tests/inflate_add_basic.phpt sapi/cli/tests/upload_2G.phpt + +# gd errors more verbose than expected +ext/gd/tests/bug39780_extern.phpt +ext/gd/tests/bug45799.phpt +ext/gd/tests/bug77973.phpt +ext/gd/tests/createfromwbmp2_extern.phpt +ext/gd/tests/libgd00086_extern.phpt + +# no XPM support in system gd +ext/gd/tests/xpm2gd.phpt +ext/gd/tests/xpm2jpg.phpt +ext/gd/tests/xpm2png.phpt + +# misc differences when using system gd +ext/gd/tests/bug43073.phpt +ext/gd/tests/bug48732-mb.phpt +ext/gd/tests/bug48732.phpt +ext/gd/tests/bug48801-mb.phpt +ext/gd/tests/bug48801.phpt +ext/gd/tests/bug53504.phpt +ext/gd/tests/bug65148.phpt +ext/gd/tests/bug73272.phpt +ext/gd/tests/bug73869.phpt +ext/gd/tests/bug79067.phpt +ext/gd/tests/bug79068.phpt + +# requires a default route to be set, which isn't the case during +# network isolation +ext/sockets/tests/bug63000.phpt + +# This should be skipped like long_columns.phpt is but it's missing the +# additional checks +ext/pdo_odbc/tests/max_columns.phpt + +# enchant-2 doesn't support enchant_broker_(get|set)_dict_path +# https://news-web.php.net/php.internals/100882 +ext/enchant/tests/bug53070.phpt + +# Warning: zend_signal: handler was replaced +ext/readline/tests/libedit_callback_handler_install_001.phpt +ext/readline/tests/libedit_callback_handler_remove_001.phpt + +# soap server's sum is not accumulating +ext/soap/tests/server009.phpt + +# "Resource bundle source files are compiled with the genrb tool into a +# binary runtime form (.res files) that is portable among platforms with +# the same charset family (ASCII vs. EBCDIC) and **endianness**." +# +# Therefore these tests which use little-endian .res files will not work +# on our big endian arches... +ext/intl/tests/resourcebundle_arrayaccess.phpt +ext/intl/tests/resourcebundle_countable.phpt +ext/intl/tests/resourcebundle_create.phpt +ext/intl/tests/resourcebundle_individual.phpt +ext/intl/tests/resourcebundle_iterator.phpt +ext/intl/tests/resourcebundle_locales.phpt +ext/intl/tests/resourcebundle_traversable.phpt diff --git a/user/php7/enchant-2.patch b/user/php7/enchant-2.patch index ed048de28..709345cf0 100644 --- a/user/php7/enchant-2.patch +++ b/user/php7/enchant-2.patch @@ -1,31 +1,33 @@ -Lifted from Arch: https://git.archlinux.org/svntogit/packages.git/tree/trunk/enchant-2.patch?h=packages/php - ---- php-7.1.13/ext/enchant/config.m4.orig 2018-01-03 02:32:29.000000000 +0000 -+++ php-7.1.13/ext/enchant/config.m4 2018-01-21 22:10:03.788875780 +0000 -@@ -14,9 +14,9 @@ - ENCHANT_SEARCH_DIRS="/usr/local /usr" - fi - for i in $ENCHANT_SEARCH_DIRS; do -- if test -f $i/include/enchant/enchant.h; then -+ if test -f $i/include/enchant-2/enchant.h; then - ENCHANT_DIR=$i -- ENCHANT_INCDIR=$i/include/enchant -+ ENCHANT_INCDIR=$i/include/enchant-2 - elif test -f $i/include/enchant.h; then - ENCHANT_DIR=$i - ENCHANT_INCDIR=$i/include -@@ -31,7 +31,7 @@ - - AC_DEFINE(HAVE_ENCHANT,1,[ ]) - PHP_SUBST(ENCHANT_SHARED_LIBADD) -- PHP_ADD_LIBRARY_WITH_PATH(enchant, $ENCHANT_LIBDIR, ENCHANT_SHARED_LIBADD) -+ PHP_ADD_LIBRARY_WITH_PATH(enchant-2, $ENCHANT_LIBDIR, ENCHANT_SHARED_LIBADD) - PHP_ADD_INCLUDE($ENCHANT_INCDIR) - PHP_CHECK_LIBRARY(enchant, enchant_broker_set_param, - [ ---- php-7.2.1/ext/enchant/enchant.c.orig 2018-01-02 22:36:05.000000000 +0000 -+++ php-7.2.1/ext/enchant/enchant.c 2018-01-21 22:34:50.205791491 +0000 -@@ -741,7 +741,7 @@ +--- php-7.4.4/ext/enchant/config.m4 2020-03-17 10:40:22.000000000 +0000 ++++ php-7.4.4/ext/enchant/config.m4 2020-03-27 21:25:27.754470703 +0000 +@@ -4,21 +4,21 @@ PHP_ARG_WITH([enchant], + [Include Enchant support])]) + + if test "$PHP_ENCHANT" != "no"; then +- PKG_CHECK_MODULES([ENCHANT], [enchant]) ++ PKG_CHECK_MODULES([ENCHANT], [enchant-2]) + + PHP_EVAL_INCLINE($ENCHANT_CFLAGS) + PHP_EVAL_LIBLINE($ENCHANT_LIBS, ENCHANT_SHARED_LIBADD) + + AC_DEFINE(HAVE_ENCHANT, 1, [ ]) + +- PHP_CHECK_LIBRARY(enchant, enchant_get_version, ++ PHP_CHECK_LIBRARY(enchant-2, enchant_get_version, + [ + AC_DEFINE(HAVE_ENCHANT_GET_VERSION, 1, [ ]) + ], [ ], [ + $ENCHANT_LIBS + ]) + +- PHP_CHECK_LIBRARY(enchant, enchant_broker_set_param, ++ PHP_CHECK_LIBRARY(enchant-2, enchant_broker_set_param, + [ + AC_DEFINE(HAVE_ENCHANT_BROKER_SET_PARAM, 1, [ ]) + ], [ ], [ +--- a/ext/enchant/enchant.c.orig ++++ b/ext/enchant/enchant.c +@@ -738,7 +738,7 @@ for (i = 0; i < n_sugg; i++) { add_next_index_string(sugg, suggs[i]); } @@ -34,7 +36,7 @@ Lifted from Arch: https://git.archlinux.org/svntogit/packages.git/tree/trunk/enc } -@@ -798,7 +798,7 @@ +@@ -793,7 +793,7 @@ add_next_index_string(return_value, suggs[i]); } @@ -43,7 +45,7 @@ Lifted from Arch: https://git.archlinux.org/svntogit/packages.git/tree/trunk/enc } } /* }}} */ -@@ -818,7 +818,7 @@ +@@ -813,7 +813,7 @@ PHP_ENCHANT_GET_DICT; @@ -52,7 +54,7 @@ Lifted from Arch: https://git.archlinux.org/svntogit/packages.git/tree/trunk/enc } /* }}} */ -@@ -856,7 +856,7 @@ +@@ -851,7 +851,7 @@ PHP_ENCHANT_GET_DICT; diff --git a/user/php7/fix-tests-devserver.patch b/user/php7/fix-tests-devserver.patch deleted file mode 100644 index 80a72f0f1..000000000 --- a/user/php7/fix-tests-devserver.patch +++ /dev/null @@ -1,23 +0,0 @@ -From: Jakub Jirutka <jakub@jirutka.cz> -Date: Mon, 01 May 2017 01:33:00 +0200 -Subject: [PATCH] Fix tests failing due to extra message from built-in web server - -Remove messages like: - - PHP 7.1.4 Development Server started at Mon May 1 00:42:39 2017 - -from test outputs, because tests do not expect them. I have no clue what -happens here... - ---- a/run-tests.php -+++ b/run-tests.php -@@ -2005,6 +2005,9 @@ - // Does the output match what is expected? - $output = preg_replace("/\r\n/", "\n", trim($out)); - -+ // Remove message from built-in development server. -+ $output = preg_replace("/^PHP [0-9.]+ Development Server started at .*\n\n?/m", "", $output); -+ - /* when using CGI, strip the headers from the output */ - $headers = array(); - diff --git a/user/php7/getsockopt.patch b/user/php7/getsockopt.patch new file mode 100644 index 000000000..81f2bc232 --- /dev/null +++ b/user/php7/getsockopt.patch @@ -0,0 +1,37 @@ +Socket options with level IPPROTO_IP and IPPROTO_IPV6 cannot be handled +in the same switch statement as options with level SOL_SOCKET since +there may be collisions in their numerical values. + +For example, on ppc64: + +* IPV6_MULTICAST_HOPS and SO_RCVTIMEO are both 18 +* IPV6_MULTICAST_LOOP and SO_SNDTIMEO are both 19 + +etc. + +--- php-7.4.4/ext/sockets/sockets.c 2020-03-17 06:40:21.000000000 -0400 ++++ php-7.4.4/ext/sockets/sockets.c 2020-03-29 22:39:57.506751737 -0400 +@@ -2008,6 +2008,7 @@ PHP_FUNCTION(socket_get_option) + } + } + } ++ goto handle_default; + } + #if HAVE_IPV6 + else if (level == IPPROTO_IPV6) { +@@ -2017,6 +2018,7 @@ PHP_FUNCTION(socket_get_option) + } else if (ret == FAILURE) { + RETURN_FALSE; + } /* else continue */ ++ goto handle_default; + } + #endif + +@@ -2063,6 +2065,7 @@ PHP_FUNCTION(socket_get_option) + break; + + default: ++ handle_default: + optlen = sizeof(other_val); + + if (getsockopt(php_sock->bsd_socket, level, optname, (char*)&other_val, &optlen) != 0) { diff --git a/user/php7/install-pear.patch b/user/php7/install-pear.patch index 18747be94..8f5fb3444 100644 --- a/user/php7/install-pear.patch +++ b/user/php7/install-pear.patch @@ -1,7 +1,6 @@ ---- ./pear/Makefile.frag.orig 2013-04-12 07:02:27.041602514 +0000 -+++ ./pear/Makefile.frag 2013-04-12 07:04:09.065836822 +0000 -@@ -2,8 +2,11 @@ - +--- php-7.4.4/pear/Makefile.frag 2020-03-17 10:40:21.000000000 +0000 ++++ php-7.4.4/pear/Makefile.frag 2020-03-25 03:57:55.940744663 +0000 +@@ -1,7 +1,10 @@ peardir=$(PEAR_INSTALLDIR) +# help the built php to find xml extension so we can install pear diff --git a/user/php7/no-max-ent-size.patch b/user/php7/no-max-ent-size.patch new file mode 100644 index 000000000..7f28ba3f1 --- /dev/null +++ b/user/php7/no-max-ent-size.patch @@ -0,0 +1,257 @@ +--- php-7.4.4/ext/posix/posix.c 2020-03-17 10:40:22.000000000 +0000 ++++ php-7.4.4/ext/posix/posix.c 2020-03-27 03:19:13.133440186 +0000 +@@ -1084,8 +1084,11 @@ PHP_FUNCTION(posix_getgrnam) + ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE); + + #if defined(ZTS) && defined(HAVE_GETGRNAM_R) && defined(_SC_GETGR_R_SIZE_MAX) ++ errno = 0; + buflen = sysconf(_SC_GETGR_R_SIZE_MAX); +- if (buflen < 1) { ++ if (buflen == -1 && errno == 0) { ++ buflen = 1024; ++ } else if (buflen < 1) { + RETURN_FALSE; + } + buf = emalloc(buflen); +@@ -1127,9 +1130,7 @@ PHP_FUNCTION(posix_getgrgid) + { + zend_long gid; + #if defined(ZTS) && defined(HAVE_GETGRGID_R) && defined(_SC_GETGR_R_SIZE_MAX) +- int ret; + struct group _g; +- struct group *retgrptr = NULL; + long grbuflen; + char *grbuf; + #endif +@@ -1141,20 +1142,27 @@ PHP_FUNCTION(posix_getgrgid) + + #if defined(ZTS) && defined(HAVE_GETGRGID_R) && defined(_SC_GETGR_R_SIZE_MAX) + ++ errno = 0; + grbuflen = sysconf(_SC_GETGR_R_SIZE_MAX); +- if (grbuflen < 1) { ++ if (grbuflen == -1 && errno == 0) { ++ grbuflen = 1024; ++ } else if (grbuflen < 1) { + RETURN_FALSE; + } +- + grbuf = emalloc(grbuflen); ++try_again: ++ g = &_g; + +- ret = getgrgid_r(gid, &_g, grbuf, grbuflen, &retgrptr); +- if (ret || retgrptr == NULL) { +- POSIX_G(last_error) = ret; ++ if (getgrgid_r(gid, g, grbuf, grbuflen, &g) || g == NULL) { ++ if (errno == ERANGE) { ++ grbuflen *= 2; ++ grbuf = erealloc(grbuf, grbuflen); ++ goto try_again; ++ } ++ POSIX_G(last_error) = errno; + efree(grbuf); + RETURN_FALSE; + } +- g = &_g; + #else + if (NULL == (g = getgrgid(gid))) { + POSIX_G(last_error) = errno; +@@ -1210,14 +1218,23 @@ PHP_FUNCTION(posix_getpwnam) + ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE); + + #if defined(ZTS) && defined(_SC_GETPW_R_SIZE_MAX) && defined(HAVE_GETPWNAM_R) ++ errno = 0; + buflen = sysconf(_SC_GETPW_R_SIZE_MAX); +- if (buflen < 1) { ++ if (buflen == -1 && errno == 0) { ++ buflen = 1024; ++ } else if (buflen < 1) { + RETURN_FALSE; + } + buf = emalloc(buflen); ++try_again: + pw = &pwbuf; + + if (getpwnam_r(name, pw, buf, buflen, &pw) || pw == NULL) { ++ if (errno == ERANGE) { ++ buflen *= 2; ++ buf = erealloc(buf, buflen); ++ goto try_again; ++ } + efree(buf); + POSIX_G(last_error) = errno; + RETURN_FALSE; +@@ -1248,10 +1265,8 @@ PHP_FUNCTION(posix_getpwuid) + zend_long uid; + #if defined(ZTS) && defined(_SC_GETPW_R_SIZE_MAX) && defined(HAVE_GETPWUID_R) + struct passwd _pw; +- struct passwd *retpwptr = NULL; + long pwbuflen; + char *pwbuf; +- int ret; + #endif + struct passwd *pw; + +@@ -1260,19 +1275,27 @@ PHP_FUNCTION(posix_getpwuid) + ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE); + + #if defined(ZTS) && defined(_SC_GETPW_R_SIZE_MAX) && defined(HAVE_GETPWUID_R) ++ errno = 0; + pwbuflen = sysconf(_SC_GETPW_R_SIZE_MAX); +- if (pwbuflen < 1) { ++ if (pwbuflen == -1 && errno == 0) { ++ pwbuflen = 1024; ++ } else if (pwbuflen < 1) { + RETURN_FALSE; + } + pwbuf = emalloc(pwbuflen); ++try_again: ++ pw = &_pw; + +- ret = getpwuid_r(uid, &_pw, pwbuf, pwbuflen, &retpwptr); +- if (ret || retpwptr == NULL) { +- POSIX_G(last_error) = ret; ++ if (getpwuid_r(uid, pw, pwbuf, pwbuflen, &pw) || pw == NULL) { ++ if (errno == ERANGE) { ++ pwbuflen *= 2; ++ pwbuf = erealloc(pwbuf, pwbuflen); ++ goto try_again; ++ } ++ POSIX_G(last_error) = errno; + efree(pwbuf); + RETURN_FALSE; + } +- pw = &_pw; + #else + if (NULL == (pw = getpwuid(uid))) { + POSIX_G(last_error) = errno; +--- php-7.4.4/ext/standard/filestat.c 2020-03-17 10:40:30.000000000 +0000 ++++ php-7.4.4/ext/standard/filestat.c 2020-03-27 04:00:18.333479165 +0000 +@@ -302,15 +302,25 @@ PHPAPI int php_get_gid_by_name(const cha + #if defined(ZTS) && defined(HAVE_GETGRNAM_R) && defined(_SC_GETGR_R_SIZE_MAX) + struct group gr; + struct group *retgrptr; ++ errno = 0; + long grbuflen = sysconf(_SC_GETGR_R_SIZE_MAX); + char *grbuf; + +- if (grbuflen < 1) { ++ if (grbuflen == -1 && errno == 0) { ++ grbuflen = 1024; ++ } else if (grbuflen < 1) { + return FAILURE; + } + + grbuf = emalloc(grbuflen); +- if (getgrnam_r(name, &gr, grbuf, grbuflen, &retgrptr) != 0 || retgrptr == NULL) { ++try_again: ++ retgrptr = &gr; ++ if (getgrnam_r(name, &gr, grbuf, grbuflen, &retgrptr) || retgrptr == NULL) { ++ if (errno == ERANGE) { ++ grbuflen *= 2; ++ grbuf = erealloc(grbuf, grbuflen); ++ goto try_again; ++ } + efree(grbuf); + return FAILURE; + } +@@ -438,15 +448,25 @@ PHPAPI uid_t php_get_uid_by_name(const c + #if defined(ZTS) && defined(_SC_GETPW_R_SIZE_MAX) && defined(HAVE_GETPWNAM_R) + struct passwd pw; + struct passwd *retpwptr = NULL; ++ errno = 0; + long pwbuflen = sysconf(_SC_GETPW_R_SIZE_MAX); + char *pwbuf; + +- if (pwbuflen < 1) { ++ if (pwbuflen == -1 && errno == 0) { ++ pwbuflen = 1024; ++ } else if (pwbuflen < 1) { + return FAILURE; + } + + pwbuf = emalloc(pwbuflen); +- if (getpwnam_r(name, &pw, pwbuf, pwbuflen, &retpwptr) != 0 || retpwptr == NULL) { ++try_again: ++ retpwptr = &pw; ++ if (getpwnam_r(name, &pw, pwbuf, pwbuflen, &retpwptr) || retpwptr == NULL) { ++ if (errno == ERANGE) { ++ pwbuflen *= 2; ++ pwbuf = erealloc(pwbuf, pwbuflen); ++ goto try_again; ++ } + efree(pwbuf); + return FAILURE; + } +--- php-7.4.4/main/fopen_wrappers.c 2020-03-17 10:40:21.000000000 +0000 ++++ php-7.4.4/main/fopen_wrappers.c 2020-03-27 04:08:46.553487201 +0000 +@@ -366,10 +366,13 @@ PHPAPI int php_fopen_primary_script(zend + struct passwd *pw; + #if defined(ZTS) && defined(HAVE_GETPWNAM_R) && defined(_SC_GETPW_R_SIZE_MAX) + struct passwd pwstruc; ++ errno = 0; + long pwbuflen = sysconf(_SC_GETPW_R_SIZE_MAX); + char *pwbuf; + +- if (pwbuflen < 1) { ++ if (pwbuflen == -1 && errno == 0) { ++ pwbuflen = 1024; ++ } else if (pwbuflen < 1) { + return FAILURE; + } + +@@ -382,7 +385,14 @@ PHPAPI int php_fopen_primary_script(zend + memcpy(user, path_info + 2, length); + user[length] = '\0'; + #if defined(ZTS) && defined(HAVE_GETPWNAM_R) && defined(_SC_GETPW_R_SIZE_MAX) +- if (getpwnam_r(user, &pwstruc, pwbuf, pwbuflen, &pw)) { ++try_again: ++ pw = &pwstruc; ++ if (getpwnam_r(user, pw, pwbuf, pwbuflen, &pw) || pw == NULL) { ++ if (errno == ERANGE) { ++ pwbuflen *= 2; ++ pwbuf = erealloc(pwbuf, pwbuflen); ++ goto try_again; ++ } + efree(pwbuf); + return FAILURE; + } +--- php-7.4.4/main/main.c 2020-03-17 10:40:21.000000000 +0000 ++++ php-7.4.4/main/main.c 2020-03-27 03:33:22.663453619 +0000 +@@ -1487,23 +1487,27 @@ PHPAPI char *php_get_current_user(void) + struct passwd *pwd; + #if defined(ZTS) && defined(HAVE_GETPWUID_R) && defined(_SC_GETPW_R_SIZE_MAX) + struct passwd _pw; +- struct passwd *retpwptr = NULL; ++ errno = 0; + int pwbuflen = sysconf(_SC_GETPW_R_SIZE_MAX); + char *pwbuf; + +- if (pwbuflen < 1) { ++ if (pwbuflen == -1 && errno == 0) { ++ pwbuflen = 1024; ++ } else if (pwbuflen < 1) { + return ""; + } + pwbuf = emalloc(pwbuflen); +- if (getpwuid_r(pstat->st_uid, &_pw, pwbuf, pwbuflen, &retpwptr) != 0) { +- efree(pwbuf); +- return ""; +- } +- if (retpwptr == NULL) { ++try_again: ++ pwd = &_pw; ++ if (getpwuid_r(pstat->st_uid, pwd, pwbuf, pwbuflen, &pwd) || pwd == NULL) { ++ if (errno == ERANGE) { ++ pwbuflen *= 2; ++ pwbuf = erealloc(pwbuf, pwbuflen); ++ goto try_again; ++ } + efree(pwbuf); + return ""; + } +- pwd = &_pw; + #else + if ((pwd=getpwuid(pstat->st_uid))==NULL) { + return ""; diff --git a/user/php7/pwbuflen.patch b/user/php7/pwbuflen.patch deleted file mode 100644 index 7d2685b55..000000000 --- a/user/php7/pwbuflen.patch +++ /dev/null @@ -1,15 +0,0 @@ -sysconf(_SC_GETPW_R_SIZE_MAX) returns -1 on musl and 1024 on glibc. - ---- php-7.2.6/main/main.c 2018-06-04 23:30:18.790089810 -0400 -+++ php-7.2.6/main/main.c 2018-06-04 23:30:14.660089806 -0400 -@@ -1315,7 +1315,9 @@ - int pwbuflen = sysconf(_SC_GETPW_R_SIZE_MAX); - char *pwbuf; - -- if (pwbuflen < 1) { -+ if (pwbuflen == -1) { -+ pwbuflen = 1024; -+ } else if (pwbuflen < 1) { - return ""; - } - pwbuf = emalloc(pwbuflen); diff --git a/user/php7/test-fixes.patch b/user/php7/test-fixes.patch new file mode 100644 index 000000000..976783d77 --- /dev/null +++ b/user/php7/test-fixes.patch @@ -0,0 +1,71 @@ +Don't filter out "extension=" settings from INI files during check() so +we can inject our own module load order. + +--- php-7.4.4/build/Makefile.global 2020-03-17 10:40:21.000000000 +0000 ++++ php-7.4.4/build/Makefile.global 2020-03-27 06:11:09.713603308 +0000 +@@ -83,7 +83,7 @@ PHP_TEST_SHARED_EXTENSIONS = ` \ + . $$i; $(top_srcdir)/build/shtool echo -n -- " -d zend_extension=$(top_builddir)/modules/$$dlname"; \ + done; \ + fi` +-PHP_DEPRECATED_DIRECTIVES_REGEX = '^(magic_quotes_(gpc|runtime|sybase)?|(zend_)?extension(_debug)?(_ts)?)[\t\ ]*=' ++PHP_DEPRECATED_DIRECTIVES_REGEX = '^(magic_quotes_(gpc|runtime|sybase)?)[\t\ ]*=' + + test: all + @if test ! -z "$(PHP_EXECUTABLE)" && test -x "$(PHP_EXECUTABLE)"; then \ + + + + +Likewise, make sure these settings are honored for these tests. + +--- php-7.4.4/ext/opcache/tests/php_cli_server.inc 2020-03-17 10:40:23.000000000 +0000 ++++ php-7.4.4/ext/opcache/tests/php_cli_server.inc 2020-03-27 22:36:13.054537829 +0000 +@@ -11,7 +11,7 @@ function php_cli_server_start($ini = "") + $ini_array = array_map(function($arg) { + return trim($arg, '\'"'); + }, $ini_array); +- $cmd = [$php_executable, '-t', $doc_root, '-n', ...$ini_array, '-S', PHP_CLI_SERVER_ADDRESS]; ++ $cmd = [$php_executable, '-d', 'extension_dir='.ini_get('extension_dir'), '-t', $doc_root, '-n', ...$ini_array, '-S', PHP_CLI_SERVER_ADDRESS]; + $descriptorspec = array( + 0 => STDIN, + 1 => STDOUT, +--- php-7.4.4/ext/session/tests/session_regenerate_id_cookie.phpt 2020-03-17 10:40:28.000000000 +0000 ++++ php-7.4.4/ext/session/tests/session_regenerate_id_cookie.phpt 2020-03-27 06:43:24.043633893 +0000 +@@ -56,7 +56,7 @@ var_dump(session_destroy()); + ob_end_flush(); + ?>'); + +-var_dump(`$php -n -d session.name=PHPSESSID $file`); ++var_dump(`$php -c php-check.ini -d session.name=PHPSESSID $file`); + + unlink($file); + +--- php-7.4.4/ext/soap/tests/bug73037.phpt 2020-03-17 10:40:24.000000000 +0000 ++++ php-7.4.4/ext/soap/tests/bug73037.phpt 2020-03-27 23:02:05.964562383 +0000 +@@ -63,8 +63,7 @@ function get_data($max) + } + + $router = "bug73037_server.php"; +-$args = substr(PHP_OS, 0, 3) == 'WIN' +- ? ["-d", "extension_dir=" . ini_get("extension_dir"), "-d", "extension=php_soap.dll"] : []; ++$args = ["-d", "extension_dir=" . ini_get("extension_dir"), "-d", "extension=soap.so"]; + $code = <<<'PHP' + $s = new SoapServer(NULL, array('uri' => 'http://here')); + $s->setObject(new stdclass()); + + + +Don't include useless message on startup which will break every test. + +--- php-7.4.4/run-tests.php 2020-03-17 10:40:21.000000000 +0000 ++++ php-7.4.4/run-tests.php 2020-03-25 04:01:26.320747990 +0000 +@@ -2503,6 +2503,9 @@ COMMAND $cmd + // Does the output match what is expected? + $output = preg_replace("/\r\n/", "\n", trim($out)); + ++ // Remove message from built-in development server. ++ $output = preg_replace("/^PHP [0-9.]+ Development Server started at .*\n\n?/m", "", $output); ++ + /* when using CGI, strip the headers from the output */ + $headers = array(); + diff --git a/user/php7/zend_bool.patch b/user/php7/zend_bool.patch new file mode 100644 index 000000000..b2e0b0f8f --- /dev/null +++ b/user/php7/zend_bool.patch @@ -0,0 +1,19 @@ +zend_parse_parameters can't be passed &int if it's expecting zend_bool +("b", unsigned char). + +Ironically, this code (Reflect::export) is scheduled to be removed in +the next 7.4 release[1], so don't bother forwarding. + +[1] https://github.com/php/php-src/pull/5188 + +--- php-7.4.4/ext/reflection/php_reflection.c 2020-03-17 06:40:26.000000000 -0400 ++++ php-7.4.4/ext/reflection/php_reflection.c 2020-03-30 01:00:27.938405046 -0400 +@@ -1304,7 +1304,7 @@ static void _reflection_export(INTERNAL_ + zval *argument_ptr, *argument2_ptr; + zval retval, params[2]; + int result; +- int return_output = 0; ++ zend_bool return_output = 0; + zend_fcall_info fci; + zend_fcall_info_cache fcc; + diff --git a/user/php7/zip-glob-pathc.patch b/user/php7/zip-glob-pathc.patch new file mode 100644 index 000000000..74b81754a --- /dev/null +++ b/user/php7/zip-glob-pathc.patch @@ -0,0 +1,15 @@ +Upstream: https://github.com/php/php-src/pull/5311 + +--- php-7.4.4/ext/zip/php_zip.c 2020-03-17 10:40:30.000000000 +0000 ++++ php-7.4.4/ext/zip/php_zip.c 2020-03-27 15:28:13.259857804 -0500 +@@ -606,8 +606,9 @@ int php_zip_glob(char *pattern, int pattern_len, zend_long flags, zval *return_v + add_next_index_string(return_value, globbuf.gl_pathv[n]+cwd_skip); + } + ++ ret = globbuf.gl_pathc; + globfree(&globbuf); +- return globbuf.gl_pathc; ++ return ret; + #else + zend_throw_error(NULL, "Glob support is not available"); + return 0; |