diff options
author | Eugene Lamskoy | 2023-02-22 18:02:10 +0200 |
---|---|---|
committer | Eugene Lamskoy | 2023-02-22 18:02:10 +0200 |
commit | 9ab3feaeafbf9dae6a22160e3f553da8931acf34 (patch) | |
tree | 25eef03c28362d990fb93c0c9b805c97276e1154 | |
parent | 2047899ce96ed15a2b7a69615cc82989c0d98156 (diff) | |
download | aur-9ab3feaeafbf9dae6a22160e3f553da8931acf34.tar.gz |
php56 modern version
34 files changed, 9371 insertions, 1191 deletions
@@ -1,227 +1,460 @@ +# Generated by makepkg 6.0.2 +# Wed Feb 22 15:42:33 UTC 2023 pkgbase = php56 - pkgdesc = A general-purpose scripting language that is especially suited to web development + pkgdesc = PHP 5.6.40 compiled as to not conflict with mainline php pkgver = 5.6.40 - pkgrel = 2 - url = http://php.net - arch = i686 + pkgrel = 10 + url = http://www.php.net arch = x86_64 license = PHP + checkdepends = procps-ng + checkdepends = smtp-forwarder + makedepends = acl + makedepends = libtool + makedepends = autoconf + makedepends = automake + makedepends = patchelf + makedepends = gawk + makedepends = sed + makedepends = bash + makedepends = python + makedepends = libxml2 + makedepends = pam + makedepends = krb5 + makedepends = zlib + makedepends = libedit + makedepends = smtp-forwarder + makedepends = pcre makedepends = apache - makedepends = c-client + makedepends = ncurses + makedepends = libxcrypt + makedepends = systemd + makedepends = systemd-libs + makedepends = coreutils + makedepends = findutils + makedepends = libxslt + makedepends = e2fsprogs + makedepends = openssl + makedepends = db5.3 makedepends = postgresql-libs - makedepends = libldap - makedepends = smtp-forwarder - makedepends = sqlite makedepends = unixodbc - makedepends = net-snmp + makedepends = libfbclient + makedepends = libfbclient + makedepends = freetds + makedepends = sqlite + makedepends = libvpx + makedepends = gd + makedepends = tidy + makedepends = gmp makedepends = libzip + makedepends = recode + makedepends = aspell makedepends = enchant - makedepends = file - makedepends = freetds - makedepends = libmcrypt - makedepends = tidyhtml + makedepends = libvoikko + makedepends = hspell + makedepends = hunspell + makedepends = nuspell makedepends = aspell - makedepends = libltdl - makedepends = gd makedepends = icu makedepends = curl - makedepends = libxslt - makedepends = openssl-1.0 - makedepends = db - makedepends = gmp - makedepends = systemd - makedepends = libnsl - source = https://secure.php.net/distributions/php-5.6.40.tar.xz - source = https://secure.php.net/distributions/php-5.6.40.tar.xz.asc - source = php.ini.patch - source = apache.conf - source = php-fpm.conf.in.patch - source = logrotate.d.php-fpm - source = php-fpm.service - source = php-fpm.tmpfiles - source = use-enchant2.patch + makedepends = net-snmp + makedepends = libsasl + makedepends = libldap + makedepends = c-client + makedepends = pam + makedepends = libmcrypt + options = !lto + source = make-tests.patch + source = pear-config-patcher.php + source = php-makefile-patcher.php + source = php-apache.conf + source = https://php.net/distributions/php-5.6.40.tar.xz + source = php55-phar-names.patch + source = openssl-1.1.patch + source = openssl-sslv3-consts.patch + source = fpm-numeric-uid-gid.patch + source = fpm-reload-sighup.patch + source = mysql-socket-php5.3.patch + source = php-enchant-php5.3.patch + source = php-enchant-depr.patch source = php-freetype-2.9.1.patch - source = https://raw.githubusercontent.com/centminmod/centminmod/123.09beta01/patches/php/php5640-mysqlnd-fix.patch - source = 0000-gd-2.3.3-dropped-GD_FLIP_HORINZONTAL.patch - source = https://raw.githubusercontent.com/mhei/packages/6eecc3bd4c8e34e3986fde3f95ed88c784cd99eb/lang/php7/patches/1011-Accommodate-changes-to-canonicalized-forms-in-ICU-70_1.patch - validpgpkeys = 6E4F6AB321FDC07F2C332E3AC2BF0BC433CFC8B3 - validpgpkeys = 0BD78B5F97500D450838F95DFE857D9A90D90EC1 - md5sums = c7dde3afb16ce7b761abf2805125d372 - md5sums = SKIP - md5sums = c893cdf2599f68a7844cd4c91e66a18b - md5sums = dec2cbaad64e3abf4f0ec70e1de4e8e9 - md5sums = 2d0e98c423a9dc57e923f31d63117106 - md5sums = bc1006ba3308c0b641726944874da315 - md5sums = c1cc15d2123931f883f75f231ae44f60 - md5sums = 12392414f768281ae96f292d0aa9669c - md5sums = 4a9801acb02312746347095f107c68e9 - md5sums = b40b82f55208eaead22dbfb64720b064 - md5sums = ce426ef8c362dd27a74678656b5700f4 - md5sums = 3ded94e2f581d4e2c06ad2927547445c - md5sums = 08a2d47bffe8f187bf48953c272f8812 + source = php-icu-php5.5.patch + source = recode-php5.3.patch + source = php-opcache-lockfile-path.patch + source = php-mysqlnd-charsets.patch + source = php-mysqlnd.patch + source = debian-php-5.6.40.patch + source = php-phpinfo.patch + source = timezonedb-guess.patch + source = timezonedb-php5.6.patch + sha256sums = e6b8530d747000eebb0089249ec70a3b14add7b501337046700544883f62b17b + sha256sums = 0b7e98dca9c996ec10cb9b3f6296bb7547c68797fd5f35006fdfd3e97700672d + sha256sums = ba72fc64f77822755a469314160d5889d5298f4eb5758dd7939dac9b811afe52 + sha256sums = 6d0ad9becb5470ce8e5929d7d45660b0f32579038978496317544c5310281a91 sha256sums = 1369a51eee3995d7fbd1c5342e5cc917760e276d561595b6052b21ace2656d1c - sha256sums = SKIP - sha256sums = f70833674fec2575bb404a907fb01c616537629d6a4bfa7c319df04fb90e21e1 - sha256sums = 8b5b15f1c348d8897d837ea9894157d9630dc542bbb0dbc7ad93c5dc0235d1d5 - sha256sums = 71996465bf1ccd0f335cd023f74dc362c9ac8eae03ce400dc36a729d42431403 - sha256sums = e1eee1e035a3ae973c08989564227577d996fddace2bb25d0c62ef8763d109a8 - sha256sums = c65c3c140aa06868ecef672c17b467589dc03d21caf06a75511dbc19c0bae1c3 - sha256sums = 2fb61bcef63765d3491bb78cab835f1ab6819c127bef4d30945916193608eb4e - sha256sums = 471eadcbe1d28102774260fa7fcb47fb65b104c4e3fc7267c3ae59e075c8cceb - sha256sums = f9fe57f809ac13e0043d18b795ef777af3e8c710a83745b37b09db536f683d2a - sha256sums = 4599f34603b8af7c33b123bc14d2cea5832fe2275c901cbd46ff76182b1dbf13 - sha256sums = 2dce63bc61a3d484794d38dabc06df58ff45b22a7e56c4dc1b221cb4e05074ff - sha256sums = 1d0f0ef86345d5c28d6bb4abfa630e9e1e541b281ba95d36c5d517653798685c - sha512sums = 997b5a952a60cf9166671cc91fcc34c674dd62bfd5cb0a9cdf3fdf2d088b5d19943d94c1cf193f8ab71fc4957d9a9a4c7c2fb8826f937501c1c0a0858f10e329 - sha512sums = SKIP - sha512sums = e742d6e3e43bce75e11b4646cdbf06c5661c66cc22d5615caff1e293ed35e95973290940c93d6abeec2d43f02761baabf24e6954720d7df8f2bd7de2c3f9ba0d - sha512sums = a20711e301648c0e7080688d2a2522f8b6a94d35dc4a09169795618f7b09613490b46ae1805ffffca63bc29f3f4b1d36705dec1bcc55e293fc51a31a6c346d8c - sha512sums = 5e65a0cda2b873bf4f4f502ec6aef57c8c0a1c77c60a1d2c352da8871bcf213bc28b005f5517a806ee909b958c986601eb7381c6f7296f42cf3dbd3af0619035 - sha512sums = a398e9cde4ba57d243abb5b394152d87bc1fddc2d5fc934569e1f912a5a80eba3ae14720fe99fcda50722bedc5d65abcbde2822f5075091c4a83a2f6bb22c122 - sha512sums = c6b74e1b39224e79d33915a0d32fe2d08114d1dcec93035017af783b8b73b6475779e3e649abb35b73ea2fd6553120696c48ebb0894531282fbc9e1b36da9f3b - sha512sums = 9cc548c9395f0765e6ebf54604dc8e71da38ffbc10eba50ba9b7e2f91690c53056f62efa2060fc8670de94e0642027c6eaa6c2820ba99e2b489695d1e320fcf3 - sha512sums = 9fa342db6530bf1b6c86d6eb5020f86eab08b7c134d649291755d3b8356837509ac9dd8a8c8a26a7c98468045abcb128bdf9cc7c6646ccf06da43909aa7b019b - sha512sums = 0a06189f6fb3513cd2dcf9ddb590360475e2dd9a7aa8b13ab66c389c1ed40ce2361681f017cd3c6219f5b40a0a9d4978e57ca3ee4bacb7657db3285136fd2875 - sha512sums = 14720eff3bc90106c6740017344e01f678090c4b07dd4ba5d91d65b194829032a0e458f333f8c14e12279a5e0f526de9792e43f22eb2a2db48285e34a2e148e2 - sha512sums = d0b78bea3f289abce90b659eddce6dd8be608a8daee7d59300cea5e3f40dff743fc90b10acb0134fa4ef5a35b8a96539e1ac11a869df0190588e238dcf634191 - sha512sums = 116ca5d0bea92e595334a432554840a80ac18073847074ebe6e90459910707ed0d01dbcfe77977cc563527cd2212b04d4abab881154abb10675102a8c78b8369 + sha256sums = 70e3cc00d954fa2b466a0e8f356c68bbb1e92b36304deaffd34c53cb6ae5e979 + sha256sums = b0d40038d245196480cac04bf7fd18b1c5cdab5e1b75462035cb03a87fd22e08 + sha256sums = aecd8dff7022e956718407a5b98dec19acdceef08b0a58e7266b483bc3845de6 + sha256sums = d175f0c14fdb22855090c93f76e18f04320d7bf15afc057ffde947f9bb361242 + sha256sums = f5ae925036744a5e88cea2698879aea0498e1e23aee7801923d90f16be383908 + sha256sums = 12f4e3aeab72e7d24221c07b64106c496c2e300518682bd301351dc9fa6ab3cf + sha256sums = 52c5a93fb03fa8f3f99438eb803b3182766ee04e0e6b76f00b0bc848d03ff6a6 + sha256sums = 3049b76460c65a70017ba2aac8f8c45725df2bbea458a96ec7164db63639e87f + sha256sums = e07ebf146cea8e734c7704ba94f18279642df2b2f09d868781746d165041b8d5 + sha256sums = ed3184d5a6f7a3bf35ee32169f8dc3b6cba09c38f60e868e24652fe9a7dd844d + sha256sums = c9f3b0dff07a7e9688f60b92a2a15817bd7cd59a8c5278cae629d856be66de5c + sha256sums = e2fcf18cbc29476beb5f321b3392f68a769fdab8de2e28891c9781f878cae288 + sha256sums = c9b3c4153596b605a41456e8242d98e474be6391d6fb4b6ce70a21c4c23b5203 + sha256sums = 7e59ff3e1669d55f2a26ccdd748bfed6bbfd85d5d9206c1241cfd4443994f42c + sha256sums = 19e13b9b567598b1bc51e8caa979a9fb37652bc707190dd144c084ee652d35ec + sha256sums = 558e780e93dfa861a366c49b4d156d8fc43f17898f001ae6033ec63c33d5d41c + sha256sums = 40bcc1e5058602302198d0925e431495391d8469499593af477f59d84d32f764 + sha256sums = 8839419bb3aedfae3ae6c53953373d647abe68d5e5ad4a89a90f9f5df4b1d7e6 pkgname = php56 - pkgdesc = An HTML-embedded scripting language + pkgdesc = PHP. A general-purpose scripting language that is especially suited to web development + depends = zlib depends = pcre + depends = libedit + backup = etc/php56/php.ini + +pkgname = php56-cli + pkgdesc = cli (command-line executable) version for php56 + depends = php56=5.6.40 depends = libxml2 - depends = curl - depends = libzip - depends = openssl-1.0 - provides = php=5.6.40 + depends = pcre2 + depends = libedit backup = etc/php56/php.ini pkgname = php56-cgi - pkgdesc = CGI and FCGI SAPI for PHP - depends = php56 - provides = php-cgi=5.6.40 - -pkgname = php56-apache - pkgdesc = Apache SAPI for PHP - install = php-apache.install - depends = php56 - depends = apache - depends = libnsl - provides = php-apache=5.6.40 - backup = etc/httpd/conf/extra/php56_module.conf + pkgdesc = CGI and FCGI SAPI for php56 + depends = php56=5.6.40 + depends = libxml2 + depends = pcre2 + depends = libedit + backup = etc/php56/php.ini pkgname = php56-fpm - pkgdesc = FastCGI Process Manager for PHP + pkgdesc = FastCGI Process Manager for php56 install = php-fpm.install - depends = php56 - depends = systemd - provides = php-fpm=5.6.40 + depends = php56=5.6.40 + depends = systemd-libs + depends = acl + depends = libxml2 + depends = pcre2 + depends = libedit + options = !emptydirs backup = etc/php56/php-fpm.conf + backup = etc/php56/php-fpm.d/www.conf + backup = etc/php56/php.ini pkgname = php56-embed - pkgdesc = Embedded PHP SAPI library - depends = php56 - depends = libnsl - provides = php-embed=5.6.40 + pkgdesc = Embedded PHP SAPI library for php56 + depends = php56=5.6.40 + depends = ncurses + depends = systemd-libs + depends = libxcrypt + depends = acl + depends = ncurses + depends = libxml2 + depends = pcre2 + depends = libedit + options = !emptydirs + backup = etc/php56/php.ini + +pkgname = php56-apache + pkgdesc = Apache SAPI for php56 + depends = php56=5.6.40 + depends = apache + depends = libxml2 + depends = pcre2 + depends = libedit + depends = libxcrypt + depends = ncurses + backup = etc/httpd/conf/extra/ + backup = etc/php56/php.ini + +pkgname = php56-litespeed + pkgdesc = LiteSpeed SAPI for php56 + depends = php56=5.6.40 + depends = libxml2 + depends = pcre2 + depends = libedit + backup = etc/php56/php.ini + +pkgname = php56-pear + pkgdesc = PHP Extension and Application Repository (PEAR) for php56 + depends = php56=5.6.40 + depends = php56-xml=5.6.40 + depends = php56-cli=5.6.40 + depends = php56-phar=5.6.40 + +pkgname = php56-pecl + pkgdesc = PHP Extension Community Library (PECL) for php56 + depends = php56-pear=5.6.40 pkgname = php56-phpdbg - pkgdesc = Interactive PHP debugger - depends = php56 - provides = php-phpdbg=5.6.40 + pkgdesc = Interactive PHP debugger for php56 () + depends = php56=5.6.40 + depends = libxml2 + depends = pcre2 + depends = libedit + options = !emptydirs + backup = etc/php56/php.ini + +pkgname = php56-xml + pkgdesc = xml modules for php56 + depends = php56=5.6.40 + depends = libxml2 + +pkgname = php56-xsl + pkgdesc = xsl module for php56 + depends = php56-xml=5.6.40 + depends = php56-dom=5.6.40 + depends = libxslt + +pkgname = php56-xmlreader + pkgdesc = xmlreader module for php56 + depends = php56-xml=5.6.40 + +pkgname = php56-xmlwriter + pkgdesc = xmlwriter module for php56 + depends = php56-xml=5.6.40 + +pkgname = php56-wddx + pkgdesc = wddx module for php56 + depends = php56-xml=5.6.40 + +pkgname = php56-dom + pkgdesc = dom module for php56 + depends = php56-xml=5.6.40 + +pkgname = php56-simplexml + pkgdesc = simplexml module for php56 + depends = php56-xml=5.6.40 + +pkgname = php56-pdo + pkgdesc = pdo module for php56 + depends = php56=5.6.40 + +pkgname = php56-mysql + pkgdesc = MySQL modules for php56 + depends = php56=5.6.40 + depends = php56-pdo=5.6.40 + +pkgname = php56-phar + pkgdesc = phar module for php56 + depends = php56=5.6.40 + +pkgname = php56-pcntl + pkgdesc = pcntl module for php56 + depends = php56=5.6.40 + +pkgname = php56-posix + pkgdesc = posix module for php56 + depends = php56=5.6.40 + +pkgname = php56-shmop + pkgdesc = shmop module for php56 + depends = php56=5.6.40 + +pkgname = php56-sockets + pkgdesc = sockets module for php56 + depends = php56=5.6.40 + +pkgname = php56-sysvmsg + pkgdesc = sysvmsg module for php56 + depends = php56=5.6.40 + +pkgname = php56-sysvsem + pkgdesc = sysvsem module for php56 + depends = php56=5.6.40 + +pkgname = php56-sysvshm + pkgdesc = sysvshm module for php56 + depends = php56=5.6.40 + +pkgname = php56-tokenizer + pkgdesc = tokenizer module for php56 + depends = php56=5.6.40 + +pkgname = php56-dba + pkgdesc = dba module for php56 + depends = php56=5.6.40 + depends = db5.3 + +pkgname = php56-pgsql + pkgdesc = PostgreSQL modules for php56 + depends = php56=5.6.40 + depends = postgresql-libs + depends = php56-pdo=5.6.40 + +pkgname = php56-odbc + pkgdesc = ODBC modules for php56 + depends = php56=5.6.40 + depends = unixodbc + depends = php56-pdo=5.6.40 + +pkgname = php56-firebird + pkgdesc = pdo_firebird module for php56 + depends = php56=5.6.40 + depends = libfbclient + depends = php56-pdo=5.6.40 + +pkgname = php56-interbase + pkgdesc = interbase module for php56 + depends = php56=5.6.40 + depends = libfbclient pkgname = php56-dblib - pkgdesc = dblib module for PHP - depends = php56 + pkgdesc = pdo_dblib module for php56 + depends = php56=5.6.40 depends = freetds - provides = php-dblib=5.6.40 -pkgname = php56-pear - pkgdesc = PHP Extension and Application Repository - depends = php56 - provides = php-pear=5.6.40 - backup = etc/php56/pear.conf +pkgname = php56-sqlite + pkgdesc = sqlite module for php56 + depends = php56=5.6.40 + depends = sqlite + depends = php56-pdo=5.6.40 -pkgname = php56-enchant - pkgdesc = enchant module for PHP - depends = php56 - depends = enchant - provides = php-enchant=5.6.40 +pkgname = php56-mssql + pkgdesc = mssql module for php56 + depends = php56=5.6.40 + depends = freetds pkgname = php56-gd - pkgdesc = gd module for PHP - depends = php56 + pkgdesc = gd module for php56 + depends = php56=5.6.40 depends = gd - provides = php-gd=5.6.40 + depends = libvpx -pkgname = php56-imap - pkgdesc = imap module for PHP - depends = php56 - depends = c-client - provides = php-imap=5.6.40 +pkgname = php56-exif + pkgdesc = exif module for php56 + depends = php56=5.6.40 -pkgname = php56-intl - pkgdesc = intl module for PHP - depends = php56 - depends = icu - provides = php-intl=5.6.40 +pkgname = php56-tidy + pkgdesc = tidy module for php56 + depends = php56=5.6.40 + depends = tidy -pkgname = php56-ldap - pkgdesc = ldap module for PHP - depends = php56 - depends = libldap - provides = php56-ldap=5.6.40 +pkgname = php56-iconv + pkgdesc = iconv module for php56 + depends = php56=5.6.40 -pkgname = php56-mcrypt - pkgdesc = mcrypt module for PHP - depends = php56 - depends = libmcrypt - depends = libltdl - provides = php-mcrypt=5.6.40 +pkgname = php56-xmlrpc + pkgdesc = xmlrpc module for php56 + depends = php56=5.6.40 + depends = libxml2 -pkgname = php56-mssql - pkgdesc = mssql module for PHP +pkgname = php56-bcmath + pkgdesc = bcmath module for php56 depends = php56 - depends = freetds - provides = php-mssql=5.6.40 -pkgname = php56-odbc - pkgdesc = ODBC modules for PHP - depends = php56 - depends = unixodbc - provides = php-odbc=5.6.40 +pkgname = php56-gmp + pkgdesc = gmp module for php56 + depends = php56=5.6.40 + depends = gmp -pkgname = php56-pgsql - pkgdesc = PostgreSQL modules for PHP - depends = php56 - depends = postgresql-libs - provides = php-pgsql=5.6.40 +pkgname = php56-zip + pkgdesc = zip module for php56 + depends = php56=5.6.40 + depends = libzip + +pkgname = php56-bz2 + pkgdesc = bz2 module for php56 + depends = php56=5.6.40 + depends = bzip2 + +pkgname = php56-json + pkgdesc = json module for php56 + depends = php56=5.6.40 + +pkgname = php56-fileinfo + pkgdesc = fileinfo module for php56 + depends = php56=5.6.40 + +pkgname = php56-ctype + pkgdesc = ctype module for php56 + depends = php56=5.6.40 + +pkgname = php56-recode + pkgdesc = recode module for php56 + depends = php56=5.6.40 + depends = recode + +pkgname = php56-mbstring + pkgdesc = mbstring module for php56 + depends = php56=5.6.40 pkgname = php56-pspell - pkgdesc = pspell module for PHP - depends = php56 + pkgdesc = pspell module for php56 + depends = php56=5.6.40 depends = aspell - provides = php-pspell=5.6.40 + +pkgname = php56-enchant + pkgdesc = enchant module for php56 + depends = php56=5.6.40 + depends = enchant + depends = libvoikko + depends = hspell + depends = hunspell + depends = nuspell + depends = aspell + +pkgname = php56-intl + pkgdesc = intl module for php56 + depends = php56=5.6.40 + depends = icu + +pkgname = php56-calendar + pkgdesc = calendar module for php56 + depends = php56=5.6.40 + +pkgname = php56-gettext + pkgdesc = gettext module for php56 + depends = php56=5.6.40 + +pkgname = php56-soap + pkgdesc = soap module for php56 + depends = php56=5.6.40 + depends = libxml2 + +pkgname = php56-ftp + pkgdesc = FTP module for php56 + depends = php56=5.6.40 + depends = openssl + +pkgname = php56-curl + pkgdesc = curl module for php56 + depends = php56=5.6.40 + depends = curl pkgname = php56-snmp - pkgdesc = snmp module for PHP - depends = php56 + pkgdesc = snmp module for php56 + depends = php56=5.6.40 depends = net-snmp - provides = php-snmp=5.6.40 + depends = openssl -pkgname = php56-sqlite - pkgdesc = sqlite module for PHP - depends = php56 - depends = sqlite - provides = php-sqlite=5.6.40 +pkgname = php56-ldap + pkgdesc = ldap module for php56 + depends = php56=5.6.40 + depends = libldap + depends = libsasl -pkgname = php56-tidy - pkgdesc = tidy module for PHP - depends = php56 - depends = tidyhtml - provides = php-tidy=5.6.40 +pkgname = php56-imap + pkgdesc = imap module for php56 + depends = php56=5.6.40 + depends = pam + depends = krb5 + depends = c-client + depends = libxcrypt + depends = openssl -pkgname = php56-xsl - pkgdesc = xsl module for PHP - depends = php56 - depends = libxslt - provides = php-xsl=5.6.40 +pkgname = php56-mcrypt + pkgdesc = mcrypt module for php56 + depends = php56=5.6.40 + depends = libmcrypt + +pkgname = php56-opcache + pkgdesc = opcache zend module for php56 + depends = php56=5.6.40 diff --git a/0000-gd-2.3.3-dropped-GD_FLIP_HORINZONTAL.patch b/0000-gd-2.3.3-dropped-GD_FLIP_HORINZONTAL.patch deleted file mode 100644 index c9b1e9b20f14..000000000000 --- a/0000-gd-2.3.3-dropped-GD_FLIP_HORINZONTAL.patch +++ /dev/null @@ -1,21 +0,0 @@ ---- ext/gd/gd.c.orig 2019-01-09 04:54:13.000000000 -0500 -+++ ext/gd/gd.c 2021-09-15 16:58:44.556105143 -0400 -@@ -1177,10 +1177,18 @@ PHP_MINIT_FUNCTION(gd) - REGISTER_LONG_CONSTANT("IMG_ARC_PIE", gdPie, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IMG_ARC_CHORD", gdChord, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IMG_ARC_NOFILL", gdNoFill, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IMG_ARC_EDGED", gdEdged, CONST_CS | CONST_PERSISTENT); - -+/* dropped in gd.h 2.3.3 */ -+#ifndef GD_FLIP_HORINZONTAL -+#define GD_FLIP_HORINZONTAL 1 /* typo, kept for BC */ -+#define GD_FLIP_HORIZONTAL 1 -+#define GD_FLIP_VERTICAL 2 -+#define GD_FLIP_BOTH 3 -+#endif -+ - /* GD2 image format types */ - REGISTER_LONG_CONSTANT("IMG_GD2_RAW", GD2_FMT_RAW, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IMG_GD2_COMPRESSED", GD2_FMT_COMPRESSED, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IMG_FLIP_HORIZONTAL", GD_FLIP_HORINZONTAL, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IMG_FLIP_VERTICAL", GD_FLIP_VERTICAL, CONST_CS | CONST_PERSISTENT); @@ -1,605 +1,1579 @@ -# Maintainer: Chris Severance aur.severach aATt spamgourmet dott com -# Contributor: mickael9 <mickael9 at gmail.com> -# Contributor: Pierre Schmitz <pierre@archlinux.de> -# Contributor: Thore Bödecker <me@foxxx0.de> -# Contributor: Jörg Schuck <joerg_schuck [at] web.de> +############################################################################### +# Generated by arch-phpbs: https://github.com/lamskoy/arch-phpbs # -# Changes from 2016-01-10, by Thore Bödecker: -# reworked everything to allow php56 to co-exist with upstream php packages - -set -u -_pkgbase='php' -pkgbase="${_pkgbase}56" +# Maintaining/co-maintaining on AUR: php81 php80 php74 php73 php72 php71 php70 php55 php54 php53 +# +# Thanks to: +# +# AUR php80 Co-maintainer: Timo Sarawinski +# AUR php70 and php71 Co-maintainer: William Gathoye <william@gathoye.be> +# AUR php74 Co-maintainer: Tomasz Gruszka <tompear79@gmail.com> +# AUR php73 Co-maintainer: Matt Harrison <matt@harrison.us.com> +# AUR php73 Contirubutor: Pierre Schmitz <pierre@archlinux.de> +# AUR php55 Original maintainer: Raphaël Doursenaud <rdoursenaud@gmail.com> +# AUR php53 Original maintainer: Felix Yan <felixonmars@archlinux.org> +############################################################################### +_phpbase="56" +_suffix="" +pkgver="5.6.40" +pkgrel="10" +pkgbase="php56" +pkgdesc="PHP 5.6.40 compiled as to not conflict with mainline php" +_cppflags=" -DU_USING_ICU_NAMESPACE=1 -DU_DEFINE_FALSE_AND_TRUE=1 " +_build_apache_cfg="etc/httpd/conf/extra" +_build_bundled_gd="0" +_build_conf_d="etc/php56/conf.d" +_build_forced_openssl_11="0" +_build_fpm_name="php-fpm56" +_build_fpm_service_name="php56-fpm" +_build_icu_src_dir="icu/source" +_build_ini_per_sapi="0" +_build_mysql_socket="/run/mysqld/mysqld.sock" +_build_openssl_v10_patch="0" +_build_openssl_v11_patch="1" +_build_per_sapi="0" +_build_phpdbg="1" +_build_sapi_ini_apache="etc/php56" +_build_sapi_ini_cgi="etc/php56" +_build_sapi_ini_cli="etc/php56" +_build_sapi_ini_embed="etc/php56" +_build_sapi_ini_fpm="etc/php56" +_build_sapi_ini_litespeed="etc/php56" +_build_sapi_ini_phpdbg="etc/php56" +_build_sapi_litespeed="--with-litespeed" +_build_shared_gd="1" +_build_shared_json="1" +_build_shared_libedit="0" +_build_shared_mysqlnd="1" +_build_shared_openssl="0" +_build_shared_pdo="1" +_build_system_timezonedb="1" +_build_update_sqlite="0" +_build_uses_argon="0" +_build_uses_lmdb="0" +_build_with_custom_icu="0" +_pkgver_icu="64-1" +_priority_default="20" +_priority_dom="16" +_priority_json="15" +_priority_mysqlnd="10" +_priority_opcache="10" +_priority_openssl="05" +_priority_pdo="10" +_priority_xml="15" +_suffix="" +_suffix_so="5" pkgname=( - "${pkgbase}" - "${pkgbase}-cgi" - "${pkgbase}-apache" - "${pkgbase}-fpm" - "${pkgbase}-embed" - "${pkgbase}-phpdbg" - "${pkgbase}-dblib" - "${pkgbase}-pear" - "${pkgbase}-enchant" - "${pkgbase}-gd" - "${pkgbase}-imap" - "${pkgbase}-intl" - "${pkgbase}-ldap" - "${pkgbase}-mcrypt" - "${pkgbase}-mssql" - "${pkgbase}-odbc" - "${pkgbase}-pgsql" - "${pkgbase}-pspell" - "${pkgbase}-snmp" - "${pkgbase}-sqlite" - "${pkgbase}-tidy" - "${pkgbase}-xsl" + "php56" + "php56-cli" + "php56-cgi" + "php56-fpm" + "php56-embed" + "php56-apache" + "php56-litespeed" + "php56-pear" + "php56-pecl" + "php56-phpdbg" + "php56-xml" + "php56-xsl" + "php56-xmlreader" + "php56-xmlwriter" + "php56-wddx" + "php56-dom" + "php56-simplexml" + "php56-pdo" + "php56-mysql" + "php56-phar" + "php56-pcntl" + "php56-posix" + "php56-shmop" + "php56-sockets" + "php56-sysvmsg" + "php56-sysvsem" + "php56-sysvshm" + "php56-tokenizer" + "php56-dba" + "php56-pgsql" + "php56-odbc" + "php56-firebird" + "php56-interbase" + "php56-dblib" + "php56-sqlite" + "php56-mssql" + "php56-gd" + "php56-exif" + "php56-tidy" + "php56-iconv" + "php56-xmlrpc" + "php56-bcmath" + "php56-gmp" + "php56-zip" + "php56-bz2" + "php56-json" + "php56-fileinfo" + "php56-ctype" + "php56-recode" + "php56-mbstring" + "php56-pspell" + "php56-enchant" + "php56-intl" + "php56-calendar" + "php56-gettext" + "php56-soap" + "php56-ftp" + "php56-curl" + "php56-snmp" + "php56-ldap" + "php56-imap" + "php56-mcrypt" + "php56-opcache" ) -pkgver='5.6.40' -pkgrel='2' -pkgdesc="A general-purpose scripting language that is especially suited to web development" -arch=('i686' 'x86_64') -url='http://php.net' -license=('PHP') -makedepends=('apache' 'c-client' 'postgresql-libs' 'libldap' 'smtp-forwarder' - 'sqlite' 'unixodbc' 'net-snmp' 'libzip' 'enchant' 'file' 'freetds' - 'libmcrypt' 'tidyhtml' 'aspell' 'libltdl' 'gd' 'icu' - 'curl' 'libxslt' 'openssl-1.0' 'db' 'gmp' 'systemd' 'libnsl') - -_srcdir="${_pkgbase}-${pkgver}" source=( - "https://secure.php.net/distributions/${_srcdir}.tar.xz" - "https://secure.php.net/distributions/${_srcdir}.tar.xz.asc" - 'php.ini.patch' 'apache.conf' 'php-fpm.conf.in.patch' - 'logrotate.d.php-fpm' 'php-fpm.service' 'php-fpm.tmpfiles' - 'use-enchant2.patch' - 'php-freetype-2.9.1.patch' - 'https://raw.githubusercontent.com/centminmod/centminmod/123.09beta01/patches/php/php5640-mysqlnd-fix.patch' - '0000-gd-2.3.3-dropped-GD_FLIP_HORINZONTAL.patch' - 'https://raw.githubusercontent.com/mhei/packages/6eecc3bd4c8e34e3986fde3f95ed88c784cd99eb/lang/php7/patches/1011-Accommodate-changes-to-canonicalized-forms-in-ICU-70_1.patch' + "make-tests.patch" + "pear-config-patcher.php" + "php-makefile-patcher.php" + "php-apache.conf" + "https://php.net/distributions/php-${pkgver}.tar.xz" + "php55-phar-names.patch" + "openssl-1.1.patch" + "openssl-sslv3-consts.patch" + "fpm-numeric-uid-gid.patch" + "fpm-reload-sighup.patch" + "mysql-socket-php5.3.patch" + "php-enchant-php5.3.patch" + "php-enchant-depr.patch" + "php-freetype-2.9.1.patch" + "php-icu-php5.5.patch" + "recode-php5.3.patch" + "php-opcache-lockfile-path.patch" + "php-mysqlnd-charsets.patch" + "php-mysqlnd.patch" + "debian-php-5.6.40.patch" + "php-phpinfo.patch" + "timezonedb-guess.patch" + "timezonedb-php5.6.patch" +) +depends=( +) +makedepends=( + "acl" + "libtool" + "autoconf" + "automake" + "patchelf" + "gawk" + "sed" + "bash" + "python" + "libxml2" + "pam" + "krb5" + "zlib" + "libedit" + "smtp-forwarder" + "pcre" + "apache" + "ncurses" + "libxcrypt" + "systemd" + "systemd-libs" + "coreutils" + "findutils" + "libxslt" + "e2fsprogs" + "openssl" + "db5.3" + "postgresql-libs" + "unixodbc" + "libfbclient" + "libfbclient" + "freetds" + "sqlite" + "libvpx" + "gd" + "tidy" + "gmp" + "libzip" + "recode" + "aspell" + "enchant" + "libvoikko" + "hspell" + "hunspell" + "nuspell" + "aspell" + "icu" + "curl" + "net-snmp" + "libsasl" + "libldap" + "c-client" + "pam" + "libmcrypt" +) +arch=( +) +_patches=( + "php55-phar-names.patch" + "openssl-1.1.patch" + "openssl-sslv3-consts.patch" + "fpm-numeric-uid-gid.patch" + "fpm-reload-sighup.patch" + "mysql-socket-php5.3.patch" + "php-enchant-php5.3.patch" + "php-enchant-depr.patch" + "php-freetype-2.9.1.patch" + "php-icu-php5.5.patch" + "recode-php5.3.patch" + "php-opcache-lockfile-path.patch" + "php-mysqlnd-charsets.patch" + "php-mysqlnd.patch" + "debian-php-5.6.40.patch" + "php-phpinfo.patch" + "timezonedb-guess.patch" + "timezonedb-php5.6.patch" +) +_sapi_depends=( + "libxml2" + "pcre2" + "libedit" +) +_ext_depends_snmp=( + "php56=5.6.40" + "net-snmp" + "openssl" +) +_ext_depends_ftp=( + "php56=5.6.40" + "openssl" +) +_ext_depends_intl=( + "php56=5.6.40" + "icu" +) +_ext_depends_imap=( + "php56=5.6.40" + "pam" + "krb5" + "c-client" + "libxcrypt" + "openssl" +) +_ext_depends_gd=( + "php56=5.6.40" + "gd" + "libvpx" +) +_ext_depends_mysql=( + "php56=5.6.40" + "php56-pdo=5.6.40" +) +_ext_depends_dba=( + "php56=5.6.40" + "db5.3" +) +_ext_depends_odbc=( + "php56=5.6.40" + "unixodbc" + "php56-pdo=5.6.40" ) -validpgpkeys=('6E4F6AB321FDC07F2C332E3AC2BF0BC433CFC8B3' - '0BD78B5F97500D450838F95DFE857D9A90D90EC1') -md5sums=('c7dde3afb16ce7b761abf2805125d372' - 'SKIP' - 'c893cdf2599f68a7844cd4c91e66a18b' - 'dec2cbaad64e3abf4f0ec70e1de4e8e9' - '2d0e98c423a9dc57e923f31d63117106' - 'bc1006ba3308c0b641726944874da315' - 'c1cc15d2123931f883f75f231ae44f60' - '12392414f768281ae96f292d0aa9669c' - '4a9801acb02312746347095f107c68e9' - 'b40b82f55208eaead22dbfb64720b064' - 'ce426ef8c362dd27a74678656b5700f4' - '3ded94e2f581d4e2c06ad2927547445c' - '08a2d47bffe8f187bf48953c272f8812') -sha256sums=('1369a51eee3995d7fbd1c5342e5cc917760e276d561595b6052b21ace2656d1c' - 'SKIP' - 'f70833674fec2575bb404a907fb01c616537629d6a4bfa7c319df04fb90e21e1' - '8b5b15f1c348d8897d837ea9894157d9630dc542bbb0dbc7ad93c5dc0235d1d5' - '71996465bf1ccd0f335cd023f74dc362c9ac8eae03ce400dc36a729d42431403' - 'e1eee1e035a3ae973c08989564227577d996fddace2bb25d0c62ef8763d109a8' - 'c65c3c140aa06868ecef672c17b467589dc03d21caf06a75511dbc19c0bae1c3' - '2fb61bcef63765d3491bb78cab835f1ab6819c127bef4d30945916193608eb4e' - '471eadcbe1d28102774260fa7fcb47fb65b104c4e3fc7267c3ae59e075c8cceb' - 'f9fe57f809ac13e0043d18b795ef777af3e8c710a83745b37b09db536f683d2a' - '4599f34603b8af7c33b123bc14d2cea5832fe2275c901cbd46ff76182b1dbf13' - '2dce63bc61a3d484794d38dabc06df58ff45b22a7e56c4dc1b221cb4e05074ff' - '1d0f0ef86345d5c28d6bb4abfa630e9e1e541b281ba95d36c5d517653798685c') -sha512sums=('997b5a952a60cf9166671cc91fcc34c674dd62bfd5cb0a9cdf3fdf2d088b5d19943d94c1cf193f8ab71fc4957d9a9a4c7c2fb8826f937501c1c0a0858f10e329' - 'SKIP' - 'e742d6e3e43bce75e11b4646cdbf06c5661c66cc22d5615caff1e293ed35e95973290940c93d6abeec2d43f02761baabf24e6954720d7df8f2bd7de2c3f9ba0d' - 'a20711e301648c0e7080688d2a2522f8b6a94d35dc4a09169795618f7b09613490b46ae1805ffffca63bc29f3f4b1d36705dec1bcc55e293fc51a31a6c346d8c' - '5e65a0cda2b873bf4f4f502ec6aef57c8c0a1c77c60a1d2c352da8871bcf213bc28b005f5517a806ee909b958c986601eb7381c6f7296f42cf3dbd3af0619035' - 'a398e9cde4ba57d243abb5b394152d87bc1fddc2d5fc934569e1f912a5a80eba3ae14720fe99fcda50722bedc5d65abcbde2822f5075091c4a83a2f6bb22c122' - 'c6b74e1b39224e79d33915a0d32fe2d08114d1dcec93035017af783b8b73b6475779e3e649abb35b73ea2fd6553120696c48ebb0894531282fbc9e1b36da9f3b' - '9cc548c9395f0765e6ebf54604dc8e71da38ffbc10eba50ba9b7e2f91690c53056f62efa2060fc8670de94e0642027c6eaa6c2820ba99e2b489695d1e320fcf3' - '9fa342db6530bf1b6c86d6eb5020f86eab08b7c134d649291755d3b8356837509ac9dd8a8c8a26a7c98468045abcb128bdf9cc7c6646ccf06da43909aa7b019b' - '0a06189f6fb3513cd2dcf9ddb590360475e2dd9a7aa8b13ab66c389c1ed40ce2361681f017cd3c6219f5b40a0a9d4978e57ca3ee4bacb7657db3285136fd2875' - '14720eff3bc90106c6740017344e01f678090c4b07dd4ba5d91d65b194829032a0e458f333f8c14e12279a5e0f526de9792e43f22eb2a2db48285e34a2e148e2' - 'd0b78bea3f289abce90b659eddce6dd8be608a8daee7d59300cea5e3f40dff743fc90b10acb0134fa4ef5a35b8a96539e1ac11a869df0190588e238dcf634191' - '116ca5d0bea92e595334a432554840a80ac18073847074ebe6e90459910707ed0d01dbcfe77977cc563527cd2212b04d4abab881154abb10675102a8c78b8369') +_ext_depends_pgsql=( + "php56=5.6.40" + "postgresql-libs" + "php56-pdo=5.6.40" +) +_ext_depends_firebird=( + "php56=5.6.40" + "libfbclient" + "php56-pdo=5.6.40" +) +_ext_depends_sqlite=( + "php56=5.6.40" + "sqlite" + "php56-pdo=5.6.40" +) +_ext_depends_mbstring=( + "php56=5.6.40" +) +_ext_depends_openssl=( + "php56=5.6.40" + "krb5" + "e2fsprogs" + "openssl" +) +_phpconfig="\ + --prefix=/usr \ + --sbindir=/usr/bin \ + --localstatedir=/var \ + --with-layout=GNU \ + --disable-debug \ + --mandir=/usr/share/man \ + --srcdir=../php-${pkgver} \ + --libdir=/usr/lib/php${_phpbase}${_suffix} \ + --datadir=/usr/share/php${_phpbase}${_suffix} \ + --program-suffix=${_phpbase}${_suffix} \ + --with-config-file-scan-dir=/${_build_conf_d} \ + --enable-filter \ + --with-pear \ + --enable-session \ + --with-mhash=/usr \ + --with-kerberos \ + --with-mysql-sock=${_build_mysql_socket} \ + --enable-mysqlnd-compression-support \ + --datarootdir=/usr/share/php${_phpbase}${_suffix} \ + --with-zlib-dir=/usr \ + --enable-libxml \ + --with-pcre-regex=/usr \ + --disable-rpath \ + --config-cache \ + --with-system-tzdata \ + --with-openssl=/usr \ + --enable-phpdbg-readline \ + --with-libedit" +_phpextensions="\ + --enable-xml=shared \ + --with-xsl=shared \ + --enable-xmlreader=shared \ + --enable-xmlwriter=shared \ + --enable-wddx=shared \ + --enable-dom=shared \ + --enable-simplexml=shared \ + --enable-pdo=shared \ + --enable-mysqlnd=shared \ + --with-mysql=shared,mysqlnd \ + --with-mysqli=shared,mysqlnd \ + --with-pdo-mysql=shared,mysqlnd \ + --enable-phar=shared \ + --enable-pcntl=shared \ + --enable-posix=shared \ + --enable-shmop=shared \ + --enable-sockets=shared \ + --enable-sysvmsg=shared \ + --enable-sysvsem=shared \ + --enable-sysvshm=shared \ + --enable-tokenizer=shared + --enable-dba=shared \ + --with-db4=/usr \ + --without-gdbm \ + --with-cdb \ + --with-pgsql=shared,/usr \ + --with-pdo-pgsql=shared,/usr \ + --with-unixODBC=shared,/usr \ + --with-pdo-odbc=shared,unixODBC,/usr \ + --with-pdo-firebird=shared,/usr \ + --with-interbase=shared,/usr \ + --with-pdo-dblib=shared,/usr \ + --with-pdo-sqlite=shared,/usr \ + --with-sqlite3=shared,/usr \ + --with-mssql=shared,/usr \ + --with-gd=shared,/usr \ + --enable-gd-native-ttf \ + --with-vpx-dir=/usr + --with-webp-dir=/usr \ + --with-jpeg-dir=/usr \ + --with-png-dir=/usr \ + --with-xpm-dir=/usr \ + --with-freetype-dir=/usr \ + --enable-exif=shared \ + --with-tidy=shared,/usr \ + --with-iconv=shared \ + --with-xmlrpc=shared \ + --enable-bcmath=shared \ + --with-gmp=shared,/usr \ + --enable-zip=shared \ + --with-libzip=/usr \ + --with-bz2=shared,/usr \ + --enable-json=shared \ + --enable-fileinfo=shared \ + --enable-ctype=shared \ + --with-recode=shared \ + --enable-mbstring=shared \ + --enable-mbregex \ + --enable-mbregex-backtrack \ + --with-pspell=shared,/usr \ + --with-enchant=shared,/usr \ + --enable-intl=shared \ + --enable-calendar=shared \ + --with-gettext=shared,/usr \ + --enable-soap=shared \ + --enable-ftp=shared \ + --with-curl=shared,/usr \ + --with-snmp=shared,/usr \ + --with-ldap=shared,/usr \ + --with-ldap-sasl=/usr \ + --with-imap=shared,/usr \ + --with-imap-ssl=yes \ + --with-mcrypt=shared \ + --enable-opcache \ + --enable-huge-code-pages" +_phpextensions_fpm="\ + --with-fpm-user=http \ + --with-fpm-group=http \ + --with-fpm-systemd \ + --with-fpm-acl" + + +options=('!lto') +arch=("$CARCH") +checkdepends=('procps-ng' 'smtp-forwarder') +license=('PHP') +url='http://www.php.net' + +################################################################################ +# Prepare it +################################################################################ prepare() { - cd "${srcdir}/${_srcdir}" + pushd "php-${pkgver}" + + echo "[SED] scripts/phpize.in" + sed -E "s|(includedir[\t ]*=.*/php)|\1${_phpbase}${_suffix}|g" \ + -i scripts/phpize.in + + echo "[SED] scripts/phpize.m4" + sed -e "s|\[php-config\]|\[php-config${_phpbase}${_suffix}\]|g" \ + -e "s|\(PHP_ARG_WITH(\[php-config\)${_phpbase}${_suffix}\]|\1]|g" \ + -e "s|php-config, no|php-config${_phpbase}${_suffix}, no|g" \ + -i "scripts/phpize.m4" + + echo "[SED] scripts/Makefile.frag" + sed -E "s|(phpincludedir[\t ]*=.*/php)|\1${_phpbase}${_suffix}|g" \ + -i scripts/Makefile.frag + + echo "[SED] scripts/php-config.in" + sed -E "s|(include_dir[\t ]*=.*php)|\1${_phpbase}${_suffix}|g" \ + -i scripts/php-config.in + + echo "[SED] sapi/apache2handler/config.m4" + sed -e '/APACHE_THREADED_MPM=/d' \ + -i sapi/apache2handler/config.m4 + + echo "[SED] sapi/fpm/Makefile.frag" + # sed -e 's#php-fpm\$(program_suffix)#php\$(program_suffix)-fpm#' + sed -e 's/.conf.default/.conf/g' \ + -i sapi/fpm/Makefile.frag + + echo "[SED] sapi/fpm/php-fpm.service.in" + sed -E "s|ExecStart[\s]?=[\s]?@([a-zA-Z_]+)@/php-fpm|ExecStart=@\1@/${_build_fpm_name}|g; \ + s|PIDFile[\s]?=[\s]?@([a-zA-Z_]+)@/run/php-fpm.pid|PIDFile=/run/${_build_fpm_service_name}/php-fpm.pid|g" \ + -i sapi/fpm/php-fpm.service.in + + local _check_files=("sapi/fpm/www.conf.in" "sapi/fpm/php-fpm.conf.in"); + for file_conf in "${_check_files[@]}"; do + if [[ ! -f $file_conf ]]; then + continue; + fi + echo "[SED] ${file_conf}" + sed -e "s#^listen =.*#listen = /run/${_build_fpm_service_name}/php-fpm.sock#" \ + -e "s#run/php-fpm.pid#/run/${_build_fpm_service_name}/php-fpm.pid#" \ + -e 's#^;*[ \t]*listen.owner =#listen.owner =#' \ + -e 's#^;*[ \t]*listen.group =#listen.group =#' \ + -e 's#^;*[ \t]*error_log =.*#error_log = syslog#' \ + -e 's#^;*[ \t]*chdir =.*#;chdir = /srv/http#' \ + -i "${file_conf}" + done + + echo "[SED] php.ini-production" + sed -e 's#^;*[ \t]*extension_dir[\t ]*=.*/.*$#extension_dir = "___EXTENSIONDIR___"#' \ + -e "s#___EXTENSIONDIR___#/usr/lib/${pkgbase}/modules#g" \ + -e "s#^;*[ \t]*extension=#;extension=#g" \ + -e "s#^;*[ \t]*session.save_path[\t ]*=.*#session.save_path=___SESSIONS___#g" \ + -e "s#___SESSIONS___#/var/lib/${pkgbase}/sessions#g" \ + -i php.ini-production + + for patch_name in "${_patches[@]}"; do + echo "[PATCH] Applying source patch ${patch_name}"; + patch -p1 -i "../${patch_name}" + done + + if ((_phpbase <= 53)); then + PHP_AUTOCONF="/usr/bin/autoconf-2.13" ./buildconf --force + else + ./buildconf --force + fi + rm -f tests/output/stream_isatty_*.phpt + rm -f Zend/tests/arginfo_zpp_mismatch*.phpt + rm -f Zend/tests/bug79919.phpt + popd +} - patch -p0 -i "${srcdir}/php.ini.patch" - patch -p0 -i "${srcdir}/php-fpm.conf.in.patch" - # Just because our Apache 2.4 is configured with a threaded MPM by default does not mean we want to build a ZTS PHP. - # Let's supress this behaviour and build a SAPI that works fine with the prefork MPM. - sed '/APACHE_THREADED_MPM=/d' -i sapi/apache2handler/config.m4 -i configure +_build_sapi() { + _sapi="${1}" + _commands="${2}" + if (( _sapi == "cli" )); then + if [[ ! -d "build-${_sapi}" ]]; then + mkdir "build-${_sapi}" + fi + pushd "build-${_sapi}" + if [[ -L configure ]]; then + rm configure + fi + ln -s "../php-${pkgver}/configure" + popd + else + cp -Ta "build-cli" "build-${_sapi}" + fi + + pushd "build-${_sapi}" + ./configure ${_phpconfig} ${_commands} + patch -p1 -i "${srcdir}/make-tests.patch" + + if (($_sapi != "cli")); then + make clean + fi + if ((! _build_with_custom_icu)); then + sed -i -e 's|^hardcode_libdir_flag_spec=.*|hardcode_libdir_flag_spec=""|g' \ + -e 's|^runpath_var=LD_RUN_PATH|runpath_var=LIBTOOL_IS_BROKED|g' \ + libtool + fi + make + popd +} - # Allow php-tidy to compile with tidy-html5 - sed 's/buffio\.h/tidybuffio\.h/' -i ext/tidy/tidy.c +################################################################################ +# BUILD them all +################################################################################ +build() { + export EXTENSION_DIR="/usr/lib/${pkgbase}/modules" + if ((_build_openssl_v10_patch)); then + export PHP_OPENSSL_DIR="/usr/lib/openssl-1.0" + export PKG_CONFIG_PATH="/usr/lib/openssl-1.0/pkgconfig" + elif ((_build_forced_openssl_11)); then + export PHP_OPENSSL_DIR="/usr/lib/openssl-1.1" + export PKG_CONFIG_PATH="/usr/lib/openssl-1.1/pkgconfig" + fi + if [[ ! -z "${_cppflags}" ]]; then + CPPFLAGS+=" $_cppflags " + fi + if ((_build_with_custom_icu )); then + local _php5_icu_first="${srcdir}/${_build_icu_src_dir}/php${_phpbase}${suffix}-icu${_pkgver_icu}" + LDFLAGS+="-Wl,-rpath=$ORIGIN/usr/lib/${pkgbase}/icu${_pkgver_icu}/lib" + _phpextensions+=" --with-icu-dir=${_php5_icu_first} " + if [[ ! -d $_php5_icu_first ]]; then + mkdir -p "${_php5_icu_first}" + fi + pushd "${_build_icu_src_dir}" + ./configure --prefix="${_php5_icu_first}" \ + --sysconfdir="${_php5_icu_first}/etc" \ + --mandir="${_php5_icu_first}/share/man" \ + --sbindir="${_php5_icu_first}/bin" \ + --libdir="${_php5_icu_first}/lib" \ + --includedir="${_php5_icu_first}/include" \ + --disable-tests \ + --disable-debug + make -j$(nproc) + make install + ./configure --prefix="/usr/lib/${pkgbase}/icu${_pkgver_icu}" \ + --sysconfdir="/usr/lib/${pkgbase}/icu${_pkgver_icu}/etc" \ + --mandir="/usr/lib/${pkgbase}/icu${_pkgver_icu}/share/man" \ + --sbindir="/usr/lib/${pkgbase}/icu${_pkgver_icu}/bin" \ + --libdir="/usr/lib/${pkgbase}/icu${_pkgver_icu}/lib" \ + --includedir="/usr/lib/${pkgbase}/icu${_pkgver_icu}/include" \ + --disable-tests \ + --disable-debug + make -j$(nproc) + popd + fi + + if ((_build_ini_per_sapi || _build_per_sapi)); then + + # CLI + _cli_addons='' + if (( ! _build_per_sapi )); then + # CGI enabled here only for tests passing, then overriden later by cgi build + _cli_addons+=" --enable-cgi " + fi + _build_sapi "cli" "\ + --sysconfdir=/${_build_sapi_ini_cli} \ + --with-config-file-path=/${_build_sapi_ini_cli} \ + --enable-cli \ + ${_phpextensions} \ + ${_cli_addons} \ + --disable-fpm \ + --disable-embed \ + --disable-phpdbg \ + " + + # phpdbg + if ((_build_phpdbg)); then + _sapi="phpdbg" + _build_sapi "phpdbg" "\ + --sysconfdir=/${_build_sapi_ini_phpdbg} \ + --with-config-file-path=/${_build_sapi_ini_phpdbg} \ + --disable-all \ + --enable-phpdbg \ + --disable-cgi \ + --disable-cli \ + --disable-fpm \ + --disable-embed \ + " + fi + + # embed + _build_sapi "embed" "\ + --sysconfdir=/${_build_sapi_ini_embed} \ + --with-config-file-path=/${_build_sapi_ini_embed} \ + --disable-all \ + --enable-embed=shared \ + --disable-cgi \ + --disable-cli \ + --disable-fpm \ + --disable-phpdbg \ + " + + # cgi + _build_sapi "cgi" "\ + --sysconfdir=/${_build_sapi_ini_cgi} \ + --with-config-file-path=/${_build_sapi_ini_cgi} \ + --disable-all \ + --enable-cgi \ + --disable-cli \ + --disable-fpm \ + --disable-embed \ + --disable-phpdbg \ + " + + # litespeed + _cflags="${CFLAGS}" + export CFLAGS="${CFLAGS} -Wno-error=format-security" + _build_sapi "litespeed" "\ + --sysconfdir=/${_build_sapi_ini_litespeed} \ + --with-config-file-path=/${_build_sapi_ini_litespeed} \ + --disable-all \ + --disable-cgi \ + --disable-cli \ + --disable-fpm \ + --disable-embed \ + --disable-phpdbg \ + ${_build_sapi_litespeed} \ + " + export CFLAGS="${_cflags}" + + # fpm + _build_sapi "fpm" "\ + --sysconfdir=/${_build_sapi_ini_fpm} \ + --with-config-file-path=/${_build_sapi_ini_fpm} \ + --disable-all \ + --enable-fpm \ + ${_phpextensions_fpm} \ + --disable-cli \ + --disable-cgi \ + --disable-embed \ + --disable-phpdbg \ + " + else + + # CLI + if ((_build_phpdbg)); then + _cli_addons+=" --enable-phpdbg " + fi + _build_sapi "cli" "\ + --sysconfdir=/${_build_sapi_ini_cli} \ + --with-config-file-path=/${_build_sapi_ini_cli} \ + --enable-cli \ + ${_phpextensions} \ + ${_cli_addons} \ + --enable-fpm \ + --enable-cgi \ + --enable-embed=shared \ + --enable-fpm \ + ${_phpextensions_fpm} \ + ${_build_sapi_litespeed} \ + " + fi + + # apache + _build_sapi "apache" "\ + --disable-all \ + --disable-cli \ + --disable-cgi \ + --disable-fpm \ + --disable-embed \ + --disable-phpdbg \ + --with-apxs2 \ + --sysconfdir=/${_build_sapi_ini_apache} \ + --with-config-file-path=/${_build_sapi_ini_apache} \ + " - # thanks to Jörg Schuck for providing this patch - # https://gist.github.com/jschuck/5d237974e5856a221ccb347c9ccf8711 - patch -p0 -N -l -i "${srcdir}/use-enchant2.patch" +} - # fix compatibility with freetype >=2.9.1 - # kudos to Brian Evans <grknight@gentoo.org> - # https://gitweb.gentoo.org/repo/gentoo.git/plain/dev-lang/php/files/php-freetype-2.9.1.patch - patch -p1 -N -l -i "${srcdir}/php-freetype-2.9.1.patch" +check() { + pushd "build-cli" + # Check if sendmail was configured correctly (FS#47600) + export REPORT_EXIT_STATUS=1 + export NO_INTERACTION=1 + export SKIP_ONLINE_TESTS=1 + export SKIP_SLOW_TESTS=1 + export TESTS='tests Zend' + if ((_phpbase > 73)); then + export TEST_PHP_ARGS="-j$(nproc)" + fi + # Patch tests to run PHP modules in needed order + sapi/cli/php -n ../php-makefile-patcher.php Makefile + make test + popd +} + +################################################################################ +# Custom code +################################################################################ +_install_module_ini() { + local extension=$(echo "${1}" | sed 's/\.so//') + local priority="${_priority_default}" + case "${extension}" in + "json") + priority="${_priority_json}" + ;; + "xml") + priority="${_priority_xml}" + ;; + "openssl") + priority="${_priority_openssl}" + ;; + "mysqlnd") + priority="${_priority_mysqlnd}" + ;; + "pdo") + priority="${_priority_pdo}" + ;; + "opcache") + priority="${_priority_opcache}" + ;; + "dom") + priority="${_priority_dom}" + ;; + esac + local extension_type="extension" + case "${extension}" in + "opcache" | "xdebug") + extension_type="zend_extension" + ;; + "recode") + extension_type=";extension" + ;; + esac + + if [[ ! -d "${pkgdir}/${_build_conf_d}" ]]; then + mkdir -p "${pkgdir}/${_build_conf_d}" + fi + echo "${extension_type}=${extension}.so" > "${pkgdir}/${_build_conf_d}/${priority}-${extension}.ini" + chmod 0644 "$pkgdir/${_build_conf_d}/${priority}-${extension}.ini" + _last_priority=${priority} + _last_extension=${extension} +} + +_install_module() { + if [[ -f "build-cli/modules/${1}.so" ]]; then + install -D -m755 "build-cli/modules/${1}.so" "${pkgdir}/usr/lib/${pkgbase}/modules/${1}.so"; + _install_module_ini "${1}" + else + echo "[DEBUG]: Install_module can't find ${1}.so, skipped" + fi +} - # fix mysqlnd compat with mariadb versions - # stricter packet checking introduced where php is sending a byte to indicate prepared params and not sending any params - # https://raw.githubusercontent.com/centminmod/centminmod/123.09beta01/patches/php/php5640-mysqlnd-fix.patch - patch -p1 -N -l -u -i "${srcdir}/php5640-mysqlnd-fix.patch" +############################################################################### +# PHP: SAPI's +############################################################################### - # https://github.com/libgd/libgd/issues/318 - #cp -p ext/gd/gd.c{,.orig}; false - #diff -pNau5 ext/gd/gd.c{.orig,} > '0000-gd-2.3.3-dropped-GD_FLIP_HORINZONTAL.patch' - patch -Nbup0 -i "${srcdir}/0000-gd-2.3.3-dropped-GD_FLIP_HORINZONTAL.patch" +# Main package +package_php56() { + # Binary names + pkgdesc='PHP. A general-purpose scripting language that is especially suited to web development' + depends=('zlib' 'pcre' 'libedit') + if ((_build_with_custom_icu)); then + pushd "${_build_icu_src_dir}" + make DESTDIR="${pkgdir}" install + popd + pushd "${pkgdir}/usr/lib/${pkgbase}/icu${_pkgver_icu}" + rm -rf bin include share + popd + fi + + # Install session dir + install -d -m1733 "${pkgdir}/var/lib/${pkgbase}/sessions" + + # conf.d dir with shared modules + install -d -m755 "${pkgdir}/${_build_conf_d}/" + + pushd "build-cli" + make -j1 INSTALL_ROOT=${pkgdir} install-{modules,build,headers,programs} + # Cleanup for CGI" + rm -rf "${pkgdir}/usr/bin/${pkgbase}-cgi" + popd + + pushd "${pkgdir}/usr/lib/${pkgbase}/modules/" + # remove static modules + rm -f *.a + # remove modules provided by subpackages + rm -f {enchant,imap,intl,pspell,snmp,tidy,curl,ldap,bz2,bcmath,soap,zip,gmp,dba,opcache,json,gd,mcrypt,sodium,recode}.so + rm -f {pdo_dblib,mssql}.so + rm -f {dom,simplexml,xml,xmlreader,xmlwriter,xsl,wddx,xmlrpc}.so + rm -f {pgsql,pdo_pgsql}.so + rm -f {odbc,pdo_odbc}.so + rm -f {pdo_sqlite,sqlite3}.so + rm -f {pdo_firebird.so,interbase.so} + rm -f {mysqli,pdo_mysql,mysqlnd,mysql}.so + rm -f {openssl,ffi,pcntl,ftp,calendar,ctype,fileinfo,iconv,mbstring,exif,pdo,phar,posix,shmop}.so + rm -f {sockets,tokenizer,gettext,sysvmsg,sysvsem,sysvshm}.so + popd + pushd build-cli + if (( ! _build_ini_per_sapi )); then + backup=("${_build_sapi_ini_cli}/php.ini") + install -d -m755 "${pkgdir}/${_build_sapi_ini_cli}" + install -D -m644 "../php-${pkgver}/php.ini-production" "${pkgdir}/${_build_sapi_ini_cli}/php.ini" + fi + popd +} - # Fix for ICU 70 by caffe1neadd1ct - patch -p1 -N -l -u -i <(sed -e '/locale_methods/,$ d' "${srcdir}/1011-Accommodate-changes-to-canonicalized-forms-in-ICU-70_1.patch") +# Cli + phar +package_php56-cli() { + _sapi="cli" + pkgdesc="cli (command-line executable) version for ${pkgbase}" + depends=("${pkgbase}=${pkgver}") + depends+=("${_sapi_depends[@]}") + pushd "build-${_sapi}" + make -j1 INSTALL_ROOT="${pkgdir}" install-cli + make -j1 INSTALL_ROOT="${pkgdir}" install-pharcmd + if ((_build_ini_per_sapi)); then + backup=("${_build_sapi_ini_cli}/php.ini") + install -d -m755 "${pkgdir}/${_build_sapi_ini_cli}" + install -D -m644 "../php-${pkgver}/php.ini-production" "${pkgdir}/${_build_sapi_ini_cli}/php.ini" + fi + # Cleanup for CGI + rm -rf "${pkgdir}/usr/bin/${pkgbase}-cgi" + popd } +# End cli -build() { - set -u - # http://site.icu-project.org/download/61#TOC-Migration-Issues - CPPFLAGS+=' -DU_USING_ICU_NAMESPACE=1' - CPPFLAGS+=' -DU_DEFINE_FALSE_AND_TRUE=1' - CXXFLAGS+=' -std=c++11' - - local _phpconfig=( - --srcdir="../${_srcdir}" - --config-cache - --prefix='/usr' - --sysconfdir="/etc/${pkgbase}" - --localstatedir='/var' - --libdir="/usr/lib/${pkgbase}" - --datarootdir="/usr/share/${pkgbase}" - --datadir="/usr/share/${pkgbase}" - --program-suffix="${pkgbase#php}" - --with-layout='GNU' - --with-config-file-path="/etc/${pkgbase}" - --with-config-file-scan-dir="/etc/${pkgbase}/conf.d" - --disable-rpath - --without-pear - ) - - local _phpextensions=( - --enable-bcmath='shared' - --enable-calendar='shared' - --enable-dba='shared' - --enable-exif='shared' - --enable-ftp='shared' - --enable-gd-native-ttf - --enable-intl='shared' - --enable-mbstring - --enable-opcache - --enable-phar='shared' - --enable-posix='shared' - --enable-shmop='shared' - --enable-soap='shared' - --enable-sockets='shared' - --enable-sysvmsg='shared' - --enable-sysvsem='shared' - --enable-sysvshm='shared' - --enable-zip='shared' - --with-bz2='shared' - --with-curl='shared' - --with-db4='/usr' - --with-enchant='shared,/usr' - --with-fpm-systemd - --with-freetype-dir='/usr' - --with-xpm-dir='/usr' - --with-gd='shared,/usr' - --with-gdbm - --with-gettext='shared' - --with-gmp='shared' - --with-iconv='shared' - --with-icu-dir='/usr' - --with-imap-ssl - --with-imap='shared' - --with-kerberos='/usr' - --with-jpeg-dir='/usr' - --with-vpx-dir='no' - --with-ldap='shared' - --with-ldap-sasl - --with-libzip - --with-mcrypt='shared' - --with-mhash - --with-mssql='shared' - --with-mysql-sock='/run/mysqld/mysqld.sock' - --with-mysql='shared,mysqlnd' - --with-mysqli='shared,mysqlnd' - --with-openssl='shared' - --with-pcre-regex='/usr' - --with-pdo-dblib='shared,/usr' - --with-pdo-mysql='shared,mysqlnd' - --with-pdo-odbc='shared,unixODBC,/usr' - --with-pdo-pgsql='shared' - --with-pdo-sqlite='shared,/usr' - --with-pgsql='shared' - --with-png-dir='/usr' - --with-pspell='shared' - --with-snmp='shared' - --with-sqlite3='shared,/usr' - --with-tidy='shared' - --with-unixODBC='shared,/usr' - --with-xmlrpc='shared' - --with-xsl='shared' - --with-zlib - ) - - export EXTENSION_DIR="/usr/lib/${pkgbase}/modules" - export PEAR_INSTALLDIR="/usr/share/${pkgbase}/pear" - export PKG_CONFIG_PATH='/usr/lib/openssl-1.0/pkgconfig' - - cd "${srcdir}/${_srcdir}" - - # php - mkdir -p "${srcdir}/build-php" - cd "${srcdir}/build-php" - ln -sf "../${_srcdir}/configure" - ./configure "${_phpconfig[@]}" \ - --disable-cgi \ - --with-readline \ - --enable-pcntl \ - "${_phpextensions[@]}" - sed -i -e '/^IMAP_SHARED_LIBADD =/ s#-lssl -lcrypto#-Wl,/usr/lib/libssl.so -Wl,/usr/lib/libcrypto.so#' 'Makefile' - make -s - - # cgi and fcgi - # reuse the previous run; this will save us a lot of time - cp -Ta "${srcdir}/build-php" "${srcdir}/build-cgi" - cd "${srcdir}/build-cgi" - ./configure "${_phpconfig[@]}" \ - --disable-cli \ - --enable-cgi \ - "${_phpextensions[@]}" - make -s - - # apache - cp -Ta "${srcdir}/build-php" "${srcdir}/build-apache" - cd "${srcdir}/build-apache" - ./configure "${_phpconfig[@]}" \ - --disable-cli \ - --with-apxs2 \ - "${_phpextensions[@]}" - make -s - - # fpm - cp -Ta "${srcdir}/build-php" "${srcdir}/build-fpm" - cd "${srcdir}/build-fpm" - ./configure "${_phpconfig[@]}" \ - --disable-cli \ - --enable-fpm \ - --with-fpm-user='http' \ - --with-fpm-group='http' \ - "${_phpextensions[@]}" - make -s - - # embed - cp -Ta "${srcdir}/build-php" "${srcdir}/build-embed" - cd "${srcdir}/build-embed" - ./configure "${_phpconfig[@]}" \ - --disable-cli \ - --enable-embed='shared' \ - "${_phpextensions[@]}" - make -s - - # phpdbg - cp -Ta "${srcdir}/build-php" "${srcdir}/build-phpdbg" - cd "${srcdir}/build-phpdbg" - ./configure "${_phpconfig[@]}" \ - --disable-cli \ - --disable-cgi \ - --with-readline \ - --enable-phpdbg \ - "${_phpextensions[@]}" - make -s - - # pear - sed -i -e 's#@$(top_builddir)/sapi/cli/php $(PEAR_INSTALL_FLAGS) pear/install-pear-nozlib.phar -d#@$(top_builddir)/sapi/cli/php $(PEAR_INSTALL_FLAGS) pear/install-pear-nozlib.phar -p $(bindir)/php$(program_suffix) -d#' "${srcdir}/${_srcdir}/pear/Makefile.frag" - cp -Ta "${srcdir}/build-php" "${srcdir}/build-pear" - cd "${srcdir}/build-pear" - ./configure "${_phpconfig[@]}" \ - --disable-cgi \ - --with-readline \ - --enable-pcntl \ - --with-pear \ - "${_phpextensions[@]}" - make -s - set +u +# CGI +package_php56-cgi() { + _sapi="cgi" + pkgdesc="CGI and FCGI SAPI for ${pkgbase}" + depends=("${pkgbase}=${pkgver}") + depends+=("${_sapi_depends[@]}") + if ((_build_ini_per_sapi || _build_per_sapi)); then + pushd "build-${_sapi}" + else + pushd "build-cli" + fi + if ((_build_ini_per_sapi)); then + install -D -m644 "../php-${pkgver}/php.ini-production" "${pkgdir}/${_build_sapi_ini_cgi}/php.ini" + backup=("${_build_sapi_ini_cgi}/php.ini") + fi + case "${_phpbase}" in + 53 | 54) + install -D -m755 sapi/cgi/php-cgi "${pkgdir}/usr/bin/${pkgbase}-cgi" + ;; + *) + make -j1 INSTALL_ROOT="${pkgdir}" install-cgi + ;; + esac + popd } +# CGI end -check() { - set -u - cd "${srcdir}/${_srcdir}" +# Apache +package_php56-apache() { + _sapi="apache" + _build_mod_php_so="libphp${_suffix_so}.so" + _build_mod_php_module="php_module${_suffix_so}" + _build_build_php_script_name="php${_suffix_so}-script" + _apache_module_conf="${pkgbase}-module.conf" + pkgdesc="Apache SAPI for ${pkgbase}" + depends=("${pkgbase}=${pkgver}" 'apache') + depends+=("${_sapi_depends[@]}") + depends+=('libxcrypt'); + depends+=('ncurses'); + backup=("${_build_apache_cfg}/${_apache_module_conf}") + echo "# End of LoadModule in httpd.conf - see ArchWiki Apache HTTP Server" + echo "LoadModule ${_build_mod_php_module} modules/lib${pkgbase}.so" + echo "AddHandler ${_build_php_script_name} .php" + echo "# End of Include List" + echo "Include conf/extra/${_apache_module_conf}" + + pushd "build-${_sapi}" + if ((_build_ini_per_sapi)); then + backup+=("${_build_sapi_ini_apache}/php.ini") + install -d -m755 "${pkgdir}/${_build_sapi_ini_apache}" + install -D -m644 "../php-${pkgver}/php.ini-production" "${pkgdir}/${_build_sapi_ini_apache}/php.ini" + fi + install -D -m755 "libs/${_build_mod_php_so}" "${pkgdir}/usr/lib/httpd/modules/lib${pkgbase}.so" + patchelf --set-soname \ + "lib${pkgbase}.so" \ + "${pkgdir}/usr/lib/httpd/modules/lib${pkgbase}.so" + popd + + install -D -m644 "php-apache.conf" "${pkgdir}/${_build_apache_cfg}/${_apache_module_conf}" + echo "[SED] ${pkgdir}/${_build_apache_cfg}/${_apache_module_conf}" + sed -e "s#@MODULE@#${_build_mod_php_module}#" \ + -i "${pkgdir}/${_build_apache_cfg}/${_apache_module_conf}" +} +# Apache end - # Check if sendmail was configured correctly (FS#47600) - "${srcdir}/build-php/sapi/cli/php" -n -r 'echo ini_get("sendmail_path");' | grep -q 'sendmail' +# FPM +package_php56-fpm() { + _sapi="fpm" + install="php-fpm.install" + pkgdesc="FastCGI Process Manager for ${pkgbase}" + depends=("${pkgbase}=${pkgver}" 'systemd-libs' 'acl') + depends+=("${_sapi_depends[@]}") + backup=("${_build_sapi_ini_fpm}/php-fpm.conf") + if ((_phpbase >= 70)); then + backup+=("${_build_sapi_ini_fpm}/php-fpm.d/www.conf") + fi + options=('!emptydirs') + if ((_build_ini_per_sapi || _build_per_sapi)); then + pushd "build-${_sapi}" + else + pushd "build-cli" + fi + if ((_build_ini_per_sapi)); then + backup+=("${_build_sapi_ini_fpm}/php.ini") + install -d -m755 "${pkgdir}/${_build_sapi_ini_fpm}/" + install -D -m644 "../php-${pkgver}/php.ini-production" "${pkgdir}/${_build_sapi_ini_fpm}/php.ini" + fi + make -j1 INSTALL_ROOT="${pkgdir}" install-fpm + install -D -m644 "sapi/fpm/php-fpm.service" "${pkgdir}/usr/lib/systemd/system/${_build_fpm_service_name}.service" + echo "d /run/${_build_fpm_service_name} 755 root root" > php-fpm.tmpfiles + install -D -m644 "php-fpm.tmpfiles" "${pkgdir}/usr/lib/tmpfiles.d/${_build_fpm_service_name}.conf" + popd +} +# FPM end - REPORT_EXIT_STATUS='1' \ - NO_INTERACTION='1' \ - SKIP_ONLINE_TESTS='1' \ - SKIP_SLOW_TESTS='1' \ - "${srcdir}/build-php/sapi/cli/php" -n 'run-tests.php' -n -P 'tests' - set +u +# embed sapi +package_php56-embed() { + _sapi="embed" + pkgdesc="Embedded PHP SAPI library for ${pkgbase}" + depends=("${pkgbase}=${pkgver}" 'ncurses' 'systemd-libs' 'libxcrypt' 'acl' 'ncurses') + depends+=("${_sapi_depends[@]}") + options=('!emptydirs') + if ((_build_ini_per_sapi || _build_per_sapi)); then + pushd "build-${_sapi}" + else + pushd "build-cli" + fi + install -d -m755 "${pkgdir}/${_build_sapi_ini_embed}" + if ((_build_ini_per_sapi)); then + install -D -m644 "../php-${pkgver}/php.ini-production" "${pkgdir}/${_build_sapi_ini_embed}/php.ini" + backup=("${_build_sapi_ini_embed}/php.ini") + fi + make -j1 INSTALL_ROOT="${pkgdir}" PHP_SAPI=embed install-sapi + mv "${pkgdir}/usr/lib/libphp${_suffix_so}.so" "${pkgdir}/usr/lib/lib${pkgbase}.so" + popd + patchelf --set-soname "lib${pkgbase}.so" "${pkgdir}/usr/lib/lib${pkgbase}.so" } +# embed sapi end -package_php56() { - set -u - pkgdesc='An HTML-embedded scripting language' - depends=('pcre' 'libxml2' 'curl' 'libzip' 'openssl-1.0') - backup=("etc/${pkgbase}/php.ini") - provides=("${_pkgbase}=$pkgver") +# phpdbg sapi +package_php56-phpdbg() { + _sapi="phpdbg" + options=('!emptydirs') + pkgdesc="Interactive PHP debugger for ${pkgbase} ($_sapi)" + depends=("${pkgbase}=${pkgver}") + depends+=("${_sapi_depends[@]}") + if ((_build_ini_per_sapi || _build_per_sapi)); then + pushd "build-${_sapi}" + else + pushd "build-cli" + fi + if ((_build_ini_per_sapi)); then + backup=("${_build_sapi_ini_phpdbg}/php.ini") + install -d -m755 "${pkgdir}/${_build_sapi_ini_phpdbg}" + install -D -m644 "../php-${pkgver}/php.ini-production" "${pkgdir}/${_build_sapi_ini_phpdbg}/php.ini" + fi + make -j1 INSTALL_ROOT="${pkgdir}" "install-${_sapi}" + popd +} +# phpdbg sapi end + +# litespeed sapi +package_php56-litespeed() { + _sapi="litespeed" + pkgdesc="LiteSpeed SAPI for ${pkgbase}" + depends=("${pkgbase}=${pkgver}") + depends+=("${_sapi_depends[@]}") + if ((_build_ini_per_sapi || _build_per_sapi)); then + pushd "build-${_sapi}" + else + pushd "build-cli" + fi + if ((_build_ini_per_sapi)); then + install -D -m644 "../php-${pkgver}/php.ini-production" "${pkgdir}/${_build_sapi_ini_cgi}/php.ini" + backup=("${_build_sapi_ini_cgi}/php.ini") + fi + case "${_phpbase}" in + *) + install -D -m755 sapi/litespeed/php "${pkgdir}/usr/bin/ls${pkgbase}" + ;; + esac + popd +} +# litespeed sapi end - cd "${srcdir}/build-php" - make -j1 INSTALL_ROOT="${pkgdir}" install +############################################################################### +# PEAR + PECL +############################################################################### - # install php.ini - install -D -m644 "${srcdir}/${_srcdir}/php.ini-production" "${pkgdir}/etc/${pkgbase}/php.ini" - install -d -m755 "${pkgdir}/etc/${pkgbase}/conf.d/" +# PEAR +package_php56-pear() { + pkgdesc="PHP Extension and Application Repository (PEAR) for ${pkgbase}" + depends=( + "${pkgbase}=${pkgver}" + "php${_phpbase}-xml${_suffix}=${pkgver}" + "php${_phpbase}-cli${_suffix}=${pkgver}" + "php${_phpbase}-phar${_suffix}=${pkgver}" + ) + #backup=("${_build_sapi_ini_cli}/pear.conf") + install -d "${pkgdir}/usr/share/${pkgbase}/pear/htdocs" + install -d "${pkgdir}/usr/share/${pkgbase}/pear/data" + install -d "${pkgdir}/usr/share/${pkgbase}/pear/doc" + install -d "${pkgdir}/usr/share/${pkgbase}/pear/test" + install -d "${pkgdir}/usr/share/${pkgbase}/pear/cfg" + install -d "${pkgdir}/var/lib/${pkgbase}/pear/cache" + install -d "${pkgdir}/var/lib/${pkgbase}/pear/metadata" + install -d "${pkgdir}/var/lib/${pkgbase}/pear/download" + install -d "${pkgdir}/var/lib/${pkgbase}/pear/temp" + export PHP_PEAR_SYSCONF_DIR="${_build_sapi_ini_cli}" + pushd build-cli + + cp "${srcdir}/php-${pkgver}/pear/install-pear-nozlib.phar" "pear/install-pear-nozlib.phar" + + INSTALL_ROOT="${pkgdir}/" ./sapi/cli/php -n \ + -d extension=modules/xml.so \ + -d extension=modules/phar.so \ + -d date.timezone=UTC -d memory_limit=64M -d short_open_tag=0 -d safe_mode=0 \ + -d 'error_reporting=E_ALL&~E_DEPRECATED' -d detect_unicode=0 "pear/install-pear-nozlib.phar" \ + -ds "${_phpbase}${_suffix}" \ + --php "/usr/bin/${pkgbase}" \ + --bin "/usr/bin" \ + --man "/usr/share/man" \ + --dir "/usr/share/${pkgbase}/pear" \ + --data "/usr/share/${pkgbase}/pear/data" \ + --doc "/usr/share/${pkgbase}/pear/doc" \ + --test "/usr/share/${pkgbase}/pear/test" \ + --www "/usr/share/${pkgbase}/pear/htdocs" \ + --config "/usr/share/${pkgbase}/pear/cfg" \ + --force + # fix pear.conf with unserialize + # first arg: path to pear.conf + # second arg: PEAR base /var path + ./sapi/cli/php -n ../pear-config-patcher.php \ + "${pkgdir}/${_build_sapi_ini_cli}/pear.conf" \ + "/var/lib/${pkgbase}/pear" + popd + # remove unneeded files + rm -rf "${pkgdir}"/.{channels,depdb,depdblock,filemap,lock,registry} + #rename binaries + for i in pear peardev pecl; do + _target="${pkgbase/php/$i}" + # fix hardcoded paths + sed "s|PHP=php|PHP=\"/usr/bin/${pkgbase}\"|g; s|\"/usr/bin/php\"|\"/usr/bin/${pkgbase}\"|g; s| -n | |g" \ + -i "${pkgdir}/usr/bin/${i}" + if [[ "$i" == "pecl" ]]; then + echo "Moving ${pkgdir}/usr/bin/${i} => ${srcdir}/${pkgbase}-pecl-bin/" + mkdir -p "${srcdir}/${pkgbase}-pecl-bin/" + mv "${pkgdir}/usr/bin/pecl" "${srcdir}/${pkgbase}-pecl-bin/" + else + echo "Moving ${pkgdir}/usr/bin/${i} => ${pkgdir}/usr/bin/${_target}" + mv "${pkgdir}/usr/bin/${i}" "${pkgdir}/usr/bin/${_target}" + fi + done +} +# PEAR end + +# PECL +package_php56-pecl() { + pkgdesc="PHP Extension Community Library (PECL) for ${pkgbase}" + depends=("php${_phpbase}-pear${_suffix}=${pkgver}") + _target="${pkgbase/php/pecl}" + install -D -m755 "${srcdir}/${pkgbase}-pecl-bin/pecl" "${pkgdir}/usr/bin/${_target}" +} +# PECL end - # remove static modules - rm -f "${pkgdir}/usr/lib/${pkgbase}/modules"/*.a - # remove modules provided by sub packages - rm -f "${pkgdir}/usr/lib/${pkgbase}/modules"/{enchant,gd,imap,intl,ldap,mcrypt,mssql,odbc,pdo_odbc,pgsql,pdo_pgsql,pspell,snmp,sqlite3,pdo_sqlite,tidy,xsl,pdo_dblib}.so +############################################################################### +# PHP Modules: First need +############################################################################### - # remove empty directory - rmdir "${pkgdir}/usr/include/php/include" +# OpenSSL +package_php56-openssl() { + pkgdesc="OpenSSL module for ${pkgbase}" + depends=("${_ext_depends_openssl[@]}") + _install_module openssl +} - # move include directory - mv "${pkgdir}/usr/include/php" "${pkgdir}/usr/include/${pkgbase}" +# Json +package_php56-json() { + pkgdesc="json module for ${pkgbase}" + depends=("${pkgbase}=${pkgver}") + _install_module json +} - # fix phar symlink - rm "${pkgdir}/usr/bin/phar" - ln -sf "phar.${pkgbase/php/phar}" "${pkgdir}/usr/bin/${pkgbase/php/phar}" +# pdo +package_php56-pdo() { + pkgdesc="pdo module for ${pkgbase}" + depends=("${pkgbase}=${pkgver}") + _install_module pdo +} - # rename executables - mv "${pkgdir}/usr/bin"/phar.{phar,"${pkgbase/php/phar}"} - # rename man pages - mv "${pkgdir}/usr/share/man/man1"/{phar,"${pkgbase/php/phar}"}.1 - mv "${pkgdir}/usr/share/man/man1"/phar.{phar,"${pkgbase/php/phar}"}.1 +# mbstring +package_php56-mbstring() { + pkgdesc="mbstring module for ${pkgbase}" + depends=("${_ext_depends_mbstring[@]}") + _install_module mbstring +} - # fix paths in executables - sed -i -e "/^includedir=/c \includedir=/usr/include/${pkgbase}" "${pkgdir}/usr/bin/${pkgbase/php/phpize}" - sed -i -e "/^include_dir=/c \include_dir=/usr/include/${pkgbase}" "${pkgdir}/usr/bin/${pkgbase/php/php-config}" - # make phpize use php-config56 - sed -i -e "/^\[ --with-php-config=/c \[ --with-php-config=PATH Path to php-config [${pkgbase/php/php-config}]], ${pkgbase/php/php-config}, no)" "${pkgdir}/usr/lib/${pkgbase}/build/phpize.m4" - set +u +# phar +package_php56-phar() { + pkgdesc="phar module for ${pkgbase}" + depends=("${pkgbase}=${pkgver}") + _install_module phar } -package_php56-cgi() { - set -u - pkgdesc='CGI and FCGI SAPI for PHP' - depends=("${pkgbase}") - provides=("${_pkgbase}-cgi=$pkgver") - install -D -m755 "${srcdir}/build-cgi/sapi/cgi/php-cgi" "${pkgdir}/usr/bin/${pkgbase}-cgi" - set +u +############################################################################### +# PHP modules: XML +############################################################################### + +# XML modules combined package +package_php56-xml() { + pkgdesc="xml modules for ${pkgbase}" + depends=("${pkgbase}=${pkgver}" 'libxml2') + _install_module xml } -package_php56-apache() { - set -u - pkgdesc='Apache SAPI for PHP' - depends=("${pkgbase}" 'apache' 'libnsl') - provides=("${_pkgbase}-apache=$pkgver") - backup=("etc/httpd/conf/extra/${pkgbase}_module.conf") - install='php-apache.install' +package_php56-wddx() { + pkgdesc="wddx module for ${pkgbase}" + depends=("php${_phpbase}-xml${_suffix}=${pkgver}") + _install_module wddx +} - install -D -m755 "${srcdir}/build-apache/libs/libphp5.so" "${pkgdir}/usr/lib/httpd/modules/lib${pkgbase}.so" - install -D -m644 "${srcdir}/apache.conf" "${pkgdir}/etc/httpd/conf/extra/${pkgbase}_module.conf" - set +u +package_php56-simplexml() { + pkgdesc="simplexml module for ${pkgbase}" + depends=("php${_phpbase}-xml${_suffix}=${pkgver}") + _install_module simplexml } -package_php56-fpm() { - set -u - pkgdesc='FastCGI Process Manager for PHP' - depends=("${pkgbase}" 'systemd') - provides=("${_pkgbase}-fpm=$pkgver") - backup=("etc/${pkgbase}/php-fpm.conf") - install='php-fpm.install' +package_php56-dom() { + pkgdesc="dom module for ${pkgbase}" + depends=("php${_phpbase}-xml${_suffix}=${pkgver}") + _install_module dom +} - install -d -m755 "${pkgdir}/usr/bin" - install -D -m755 "${srcdir}/build-fpm/sapi/fpm/php-fpm" "${pkgdir}/usr/bin/${pkgbase}-fpm" +package_php56-xmlreader() { + pkgdesc="xmlreader module for ${pkgbase}" + depends=("php${_phpbase}-xml${_suffix}=${pkgver}") + _install_module xmlreader +} - install -D -m644 "${srcdir}/build-fpm/sapi/fpm/php-fpm.8" "${pkgdir}/usr/share/man/man8/${pkgbase}-fpm.8" - install -D -m644 "${srcdir}/build-fpm/sapi/fpm/php-fpm.conf" "${pkgdir}/etc/${pkgbase}/php-fpm.conf" +package_php56-xmlwriter() { + pkgdesc="xmlwriter module for ${pkgbase}" + depends=("php${_phpbase}-xml${_suffix}=${pkgver}") + _install_module xmlwriter +} - install -d -m755 "${pkgdir}/etc/${pkgbase}/fpm.d" - install -D -m644 "${srcdir}/php-fpm.tmpfiles" "${pkgdir}/usr/lib/tmpfiles.d/${pkgbase}-fpm.conf" - install -D -m644 "${srcdir}/php-fpm.service" "${pkgdir}/usr/lib/systemd/system/${pkgbase}-fpm.service" +# Tidy +package_php56-tidy() { + pkgdesc="tidy module for ${pkgbase}" + depends=("${pkgbase}=${pkgver}" 'tidy') + _install_module tidy +} - install -d -m755 "${pkgdir}/etc/logrotate.d" - install -D -m644 "${srcdir}/logrotate.d.php-fpm" "${pkgdir}/etc/logrotate.d/${pkgbase}-fpm" - set +u +# XSL +package_php56-xsl() { + pkgdesc="xsl module for ${pkgbase}" + depends=("php${_phpbase}-xml${_suffix}=${pkgver}" "php${_phpbase}-dom${_suffix}=${pkgver}") + depends+=('libxslt') + _install_module xsl } -package_php56-embed() { - set -u - pkgdesc='Embedded PHP SAPI library' - depends=("${pkgbase}" 'libnsl') - provides=("${_pkgbase}-embed=$pkgver") +############################################################################### +# PHP modules: Databases +############################################################################### + +# MySQL +package_php56-mysql() { + pkgdesc="MySQL modules for ${pkgbase}" + depends=("${_ext_depends_mysql[@]}") + _install_module mysqlnd + _install_module mysql + _install_module mysqli + _install_module pdo_mysql +} + +# pdo_sqlite + sqlite3 +package_php56-sqlite() { + pkgdesc="sqlite module for ${pkgbase}" + depends=("${_ext_depends_sqlite[@]}") + _install_module sqlite3 + _install_module pdo_sqlite +} - install -D -m755 "${srcdir}/build-embed/libs/libphp5.so" "${pkgdir}/usr/lib/libphp56.so" - install -D -m644 "${srcdir}/${_srcdir}/sapi/embed/php_embed.h" "${pkgdir}/usr/include/${pkgbase}/sapi/embed/php_embed.h" - set +u +# ODBC +package_php56-odbc() { + pkgdesc="ODBC modules for ${pkgbase}" + depends=("${_ext_depends_odbc[@]}") + _install_module odbc + _install_module pdo_odbc } -package_php56-phpdbg() { - set -u - pkgdesc='Interactive PHP debugger' - depends=("${pkgbase}") - provides=("${_pkgbase}-phpdbg=$pkgver") +# PostgreSQL +package_php56-pgsql() { + pkgdesc="PostgreSQL modules for ${pkgbase}" + depends=("${_ext_depends_pgsql[@]}") + _install_module pgsql + _install_module pdo_pgsql +} + +# interbase +package_php56-interbase() { + pkgdesc="interbase module for ${pkgbase}" + depends=("${pkgbase}=${pkgver}" "libfbclient") + _install_module interbase +} - install -d -m755 "${pkgdir}/usr/bin" - install -D -m755 "${srcdir}/build-phpdbg/sapi/phpdbg/phpdbg" "${pkgdir}/usr/bin/${pkgbase}dbg" - set +u +# firebird +package_php56-firebird() { + pkgdesc="pdo_firebird module for ${pkgbase}" + depends=("${_ext_depends_firebird[@]}") + _install_module pdo_firebird } +# pdo_dblib package_php56-dblib() { - set -u - pkgdesc='dblib module for PHP' - depends=("${pkgbase}" 'freetds') - provides=("${_pkgbase}-dblib=$pkgver") + depends=("${pkgbase}=${pkgver}" 'freetds') + pkgdesc="pdo_dblib module for ${pkgbase}" + _install_module pdo_dblib +} - install -D -m755 "${srcdir}/build-php/modules/pdo_dblib.so" "${pkgdir}/usr/lib/${pkgbase}/modules/pdo_dblib.so" - set +u +# mssql +package_php56-mssql() { + depends=("${pkgbase}=${pkgver}" 'freetds') + pkgdesc="mssql module for ${pkgbase}" + _install_module mssql } -package_php56-pear() { - set -u - pkgdesc='PHP Extension and Application Repository' - depends=("${pkgbase}") - provides=("${_pkgbase}-pear=$pkgver") - backup=("etc/${pkgbase}/pear.conf") +# Dba +package_php56-dba() { + pkgdesc="dba module for ${pkgbase}" + depends=("${_ext_depends_dba[@]}") + _install_module dba +} - cd "${srcdir}/build-pear" - make install-pear INSTALL_ROOT="${pkgdir}" - rm -rf "${pkgdir}"{"/usr/share/${pkgbase}/pear",}/.{channels,depdb,depdblock,filemap,lock,registry} +############################################################################### +# PHP Modules: internationalization, text, datetime +############################################################################### - mv "${pkgdir}/usr/bin"/{pear,"${pkgbase/php/pear}"} - mv "${pkgdir}/usr/bin"/{peardev,"${pkgbase/php/peardev}"} - mv "${pkgdir}/usr/bin"/{pecl,"${pkgbase/php/pecl}"} - set +u +# Intl +package_php56-intl() { + pkgdesc="intl module for ${pkgbase}" + depends=("${_ext_depends_intl[@]}") + if ((_build_with_custom_icu)); then + # Patch to proper path inside intl.so + patchelf --set-rpath "/usr/lib/${pkgbase}/icu${_pkgver_icu}/lib" "build-cli/modules/intl.so" + fi + _install_module intl } -package_php56-enchant() { - set -u - pkgdesc='enchant module for PHP' - depends=("${pkgbase}" 'enchant') - provides=("${_pkgbase}-enchant=$pkgver") +# Recode +package_php56-recode() { + pkgdesc="recode module for ${pkgbase}" + depends=("${pkgbase}=${pkgver}" 'recode') + _install_module recode +} + +# gettext +package_php56-gettext() { + pkgdesc="gettext module for ${pkgbase}" + depends=("${pkgbase}=${pkgver}") + _install_module gettext +} + +# iconv +package_php56-iconv() { + pkgdesc="iconv module for ${pkgbase}" + depends=("${pkgbase}=${pkgver}") + _install_module iconv +} - install -D -m755 "${srcdir}/build-php/modules/enchant.so" "${pkgdir}/usr/lib/${pkgbase}/modules/enchant.so" - set +u +# calendar +package_php56-calendar() { + pkgdesc="calendar module for ${pkgbase}" + depends=("${pkgbase}=${pkgver}") + _install_module calendar } + +############################################################################### +# PHP Modules: multimedia +############################################################################### + +# GD package_php56-gd() { - set -u - pkgdesc='gd module for PHP' - depends=("${pkgbase}" 'gd') - provides=("${_pkgbase}-gd=$pkgver") + pkgdesc="gd module for ${pkgbase}" + depends=("${_ext_depends_gd[@]}") + _install_module gd +} - install -D -m755 "${srcdir}/build-php/modules/gd.so" "${pkgdir}/usr/lib/${pkgbase}/modules/gd.so" - set +u +# exif +package_php56-exif() { + pkgdesc="exif module for ${pkgbase}" + depends=("${pkgbase}=${pkgver}") + _install_module exif +} + +# fileinfo +package_php56-fileinfo() { + pkgdesc="fileinfo module for ${pkgbase}" + depends=("${pkgbase}=${pkgver}") + _install_module fileinfo } -package_php56-imap() { - set -u - pkgdesc='imap module for PHP' - depends=("${pkgbase}" 'c-client') - provides=("${_pkgbase}-imap=$pkgver") - install -D -m755 "${srcdir}/build-php/modules/imap.so" "${pkgdir}/usr/lib/${pkgbase}/modules/imap.so" - set +u +############################################################################### +# PHP modules: math +############################################################################### + +# bcmath +package_php56-bcmath() { + pkgdesc="bcmath module for ${pkgbase}" + depends=("${pkgbase}") + _install_module bcmath } -package_php56-intl() { - set -u - pkgdesc='intl module for PHP' - depends=("${pkgbase}" 'icu') - provides=("${_pkgbase}-intl=$pkgver") +# gmp +package_php56-gmp() { + pkgdesc="gmp module for ${pkgbase}" + depends=("${pkgbase}=${pkgver}" 'gmp') + _install_module gmp +} + +############################################################################### +# PHP modules: spell checking +############################################################################### - install -D -m755 "${srcdir}/build-php/modules/intl.so" "${pkgdir}/usr/lib/${pkgbase}/modules/intl.so" - set +u +# Enchant +package_php56-enchant() { + pkgdesc="enchant module for ${pkgbase}" + depends=("${pkgbase}=${pkgver}" 'enchant' 'libvoikko' 'hspell' 'hunspell' 'nuspell' 'aspell') + _install_module enchant } -package_php56-ldap() { - set -u - pkgdesc='ldap module for PHP' - depends=("${pkgbase}" 'libldap') - provides=("${pkgbase}-ldap=$pkgver") +# Pspell +package_php56-pspell() { + pkgdesc="pspell module for ${pkgbase}" + depends=("${pkgbase}=${pkgver}" 'aspell') + _install_module pspell +} + +############################################################################### +# PHP modules: compression +############################################################################### - install -D -m755 "${srcdir}/build-php/modules/ldap.so" "${pkgdir}/usr/lib/${pkgbase}/modules/ldap.so" - set +u +# bz2 +package_php56-bz2() { + pkgdesc="bz2 module for ${pkgbase}" + depends=("${pkgbase}=${pkgver}" 'bzip2') + _install_module bz2 } -package_php56-mcrypt() { - set -u - pkgdesc='mcrypt module for PHP' - depends=("${pkgbase}" 'libmcrypt' 'libltdl') - provides=("${_pkgbase}-mcrypt=$pkgver") +# Zip +package_php56-zip() { + pkgdesc="zip module for ${pkgbase}" + depends=("${pkgbase}=${pkgver}" 'libzip') + _install_module zip +} - install -D -m755 "${srcdir}/build-php/modules/mcrypt.so" "${pkgdir}/usr/lib/${pkgbase}/modules/mcrypt.so" - set +u +############################################################################### +# PHP modules: network client/servers +############################################################################### + +# curl +package_php56-curl() { + pkgdesc="curl module for ${pkgbase}" + depends=("${pkgbase}=${pkgver}" "curl") + _install_module curl } -package_php56-mssql() { - set -u - pkgdesc='mssql module for PHP' - depends=("${pkgbase}" 'freetds') - provides=("${_pkgbase}-mssql=$pkgver") +# SOAP +package_php56-soap() { + pkgdesc="soap module for ${pkgbase}" + depends=("${pkgbase}=${pkgver}" 'libxml2') + _install_module soap +} - install -D -m755 "${srcdir}/build-php/modules/mssql.so" "${pkgdir}/usr/lib/${pkgbase}/modules/mssql.so" - set +u +# FTP +package_php56-ftp() { + pkgdesc="FTP module for ${pkgbase}" + depends=("${_ext_depends_ftp[@]}") + _install_module ftp } -package_php56-odbc() { - set -u - pkgdesc='ODBC modules for PHP' - depends=("${pkgbase}" 'unixodbc') - provides=("${_pkgbase}-odbc=$pkgver") +# ldap +package_php56-ldap() { + pkgdesc="ldap module for ${pkgbase}" + depends=("${pkgbase}=${pkgver}" 'libldap' 'libsasl') + _install_module ldap +} - install -D -m755 "${srcdir}/build-php/modules/odbc.so" "${pkgdir}/usr/lib/${pkgbase}/modules/odbc.so" - install -D -m755 "${srcdir}/build-php/modules/pdo_odbc.so" "${pkgdir}/usr/lib/${pkgbase}/modules/pdo_odbc.so" - set +u +# SNMP +package_php56-snmp() { + pkgdesc="snmp module for ${pkgbase}" + depends=("${_ext_depends_snmp[@]}") + _install_module snmp } -package_php56-pgsql() { - set -u - pkgdesc='PostgreSQL modules for PHP' - depends=("${pkgbase}" 'postgresql-libs') - provides=("${_pkgbase}-pgsql=$pkgver") +# XML-RPC +package_php56-xmlrpc() { + pkgdesc="xmlrpc module for ${pkgbase}" + depends=("${pkgbase}=${pkgver}" 'libxml2') + _install_module xmlrpc +} - install -D -m755 "${srcdir}/build-php/modules/pgsql.so" "${pkgdir}/usr/lib/${pkgbase}/modules/pgsql.so" - install -D -m755 "${srcdir}/build-php/modules/pdo_pgsql.so" "${pkgdir}/usr/lib/${pkgbase}/modules/pdo_pgsql.so" - set +u +# Imap +package_php56-imap() { + pkgdesc="imap module for ${pkgbase}" + depends=("${_ext_depends_imap[@]}") + _install_module imap } -package_php56-pspell() { - set -u - pkgdesc='pspell module for PHP' - depends=("${pkgbase}" 'aspell') - provides=("${_pkgbase}-pspell=$pkgver") +# sockets +package_php56-sockets() { + pkgdesc="sockets module for ${pkgbase}" + depends=("${pkgbase}=${pkgver}") + _install_module sockets +} - install -D -m755 "${srcdir}/build-php/modules/pspell.so" "${pkgdir}/usr/lib/${pkgbase}/modules/pspell.so" - set +u +############################################################################### +# PHP Modules: cryptography +############################################################################### + +# Sodium +package_php56-sodium() { + pkgdesc="sodium (libsodium) module for ${pkgbase}" + depends=("${pkgbase}=${pkgver}" "libsodium") + _install_module sodium } -package_php56-snmp() { - set -u - pkgdesc='snmp module for PHP' - depends=("${pkgbase}" 'net-snmp') - provides=("${_pkgbase}-snmp=$pkgver") +# Mcrypt +package_php56-mcrypt() { + pkgdesc="mcrypt module for ${pkgbase}" + depends=("${pkgbase}=${pkgver}" 'libmcrypt') + _install_module mcrypt +} + + +############################################################################### +# PHP Zend modules: opcache/jit +############################################################################### - install -D -m755 "${srcdir}/build-php/modules/snmp.so" "${pkgdir}/usr/lib/${pkgbase}/modules/snmp.so" - set +u +# Opcache +package_php56-opcache() { + pkgdesc="opcache zend module for ${pkgbase}" + depends=("${pkgbase}=${pkgver}") + _install_module opcache } -package_php56-sqlite() { - set -u - pkgdesc='sqlite module for PHP' - depends=("${pkgbase}" 'sqlite') - provides=("${_pkgbase}-sqlite=$pkgver") +############################################################################### +# PHP posix, pcntl, shmop and System V modules +############################################################################### - install -D -m755 "${srcdir}/build-php/modules/sqlite3.so" "${pkgdir}/usr/lib/${pkgbase}/modules/sqlite3.so" - install -D -m755 "${srcdir}/build-php/modules/pdo_sqlite.so" "${pkgdir}/usr/lib/${pkgbase}/modules/pdo_sqlite.so" - set +u +# posix +package_php56-posix() { + pkgdesc="posix module for ${pkgbase}" + depends=("${pkgbase}=${pkgver}") + _install_module posix } -package_php56-tidy() { - set -u - pkgdesc='tidy module for PHP' - depends=("${pkgbase}" 'tidyhtml') - provides=("${_pkgbase}-tidy=$pkgver") +# pcntl +package_php56-pcntl() { + pkgdesc="pcntl module for ${pkgbase}" + depends=("${pkgbase}=${pkgver}") + _install_module pcntl +} - install -D -m755 "${srcdir}/build-php/modules/tidy.so" "${pkgdir}/usr/lib/${pkgbase}/modules/tidy.so" - set +u +# shmop +package_php56-shmop() { + pkgdesc="shmop module for ${pkgbase}" + depends=("${pkgbase}=${pkgver}") + _install_module shmop } -package_php56-xsl() { - set -u - pkgdesc='xsl module for PHP' - depends=("${pkgbase}" 'libxslt') - provides=("${_pkgbase}-xsl=$pkgver") +# sysvmsg +package_php56-sysvmsg() { + pkgdesc="sysvmsg module for ${pkgbase}" + depends=("${pkgbase}=${pkgver}") + _install_module sysvmsg +} + +# sysvsem +package_php56-sysvsem() { + pkgdesc="sysvsem module for ${pkgbase}" + depends=("${pkgbase}=${pkgver}") + _install_module sysvsem +} + +# sysvshm +package_php56-sysvshm() { + pkgdesc="sysvshm module for ${pkgbase}" + depends=("${pkgbase}=${pkgver}") + _install_module sysvshm +} - install -D -m755 "${srcdir}/build-php/modules/xsl.so" "${pkgdir}/usr/lib/${pkgbase}/modules/xsl.so" - set +u +############################################################################### +# PHP Misc modules +############################################################################### + +# Ffi +package_php56-ffi() { + pkgdesc="ffi module for ${pkgbase}" + depends=("${pkgbase}=${pkgver}" 'libffi') + _install_module ffi +} + +# ctype +package_php56-ctype() { + pkgdesc="ctype module for ${pkgbase}" + depends=("${pkgbase}=${pkgver}") + _install_module ctype +} + +# tokenizer +package_php56-tokenizer() { + pkgdesc="tokenizer module for ${pkgbase}" + depends=("${pkgbase}=${pkgver}") + _install_module tokenizer } -set +u + +# libedit/readline +package_php56-readline() { + pkgdesc="readline (libedit version) module for ${pkgbase}" + depends=("${pkgbase}=${pkgver}" 'libedit') + _install_module readline +} + + +sha256sums=('e6b8530d747000eebb0089249ec70a3b14add7b501337046700544883f62b17b' + '0b7e98dca9c996ec10cb9b3f6296bb7547c68797fd5f35006fdfd3e97700672d' + 'ba72fc64f77822755a469314160d5889d5298f4eb5758dd7939dac9b811afe52' + '6d0ad9becb5470ce8e5929d7d45660b0f32579038978496317544c5310281a91' + '1369a51eee3995d7fbd1c5342e5cc917760e276d561595b6052b21ace2656d1c' + '70e3cc00d954fa2b466a0e8f356c68bbb1e92b36304deaffd34c53cb6ae5e979' + 'b0d40038d245196480cac04bf7fd18b1c5cdab5e1b75462035cb03a87fd22e08' + 'aecd8dff7022e956718407a5b98dec19acdceef08b0a58e7266b483bc3845de6' + 'd175f0c14fdb22855090c93f76e18f04320d7bf15afc057ffde947f9bb361242' + 'f5ae925036744a5e88cea2698879aea0498e1e23aee7801923d90f16be383908' + '12f4e3aeab72e7d24221c07b64106c496c2e300518682bd301351dc9fa6ab3cf' + '52c5a93fb03fa8f3f99438eb803b3182766ee04e0e6b76f00b0bc848d03ff6a6' + '3049b76460c65a70017ba2aac8f8c45725df2bbea458a96ec7164db63639e87f' + 'e07ebf146cea8e734c7704ba94f18279642df2b2f09d868781746d165041b8d5' + 'ed3184d5a6f7a3bf35ee32169f8dc3b6cba09c38f60e868e24652fe9a7dd844d' + 'c9f3b0dff07a7e9688f60b92a2a15817bd7cd59a8c5278cae629d856be66de5c' + 'e2fcf18cbc29476beb5f321b3392f68a769fdab8de2e28891c9781f878cae288' + 'c9b3c4153596b605a41456e8242d98e474be6391d6fb4b6ce70a21c4c23b5203' + '7e59ff3e1669d55f2a26ccdd748bfed6bbfd85d5d9206c1241cfd4443994f42c' + '19e13b9b567598b1bc51e8caa979a9fb37652bc707190dd144c084ee652d35ec' + '558e780e93dfa861a366c49b4d156d8fc43f17898f001ae6033ec63c33d5d41c' + '40bcc1e5058602302198d0925e431495391d8469499593af477f59d84d32f764' + '8839419bb3aedfae3ae6c53953373d647abe68d5e5ad4a89a90f9f5df4b1d7e6') diff --git a/apache.conf b/apache.conf deleted file mode 100644 index c3ca0aad509e..000000000000 --- a/apache.conf +++ /dev/null @@ -1,13 +0,0 @@ -# Required modules: dir_module, php5_module - -<IfModule dir_module> - <IfModule php5_module> - DirectoryIndex index.php index.html - <FilesMatch "\.php$"> - SetHandler application/x-httpd-php - </FilesMatch> - <FilesMatch "\.phps$"> - SetHandler application/x-httpd-php-source - </FilesMatch> - </IfModule> -</IfModule> diff --git a/debian-php-5.6.40.patch b/debian-php-5.6.40.patch new file mode 100644 index 000000000000..c4dccca9ec74 --- /dev/null +++ b/debian-php-5.6.40.patch @@ -0,0 +1,4913 @@ + +diff --git a/ext/standard/proc_open.c b/ext/standard/proc_open.c +index ac4f5b7..1e99293 100644 +--- a/ext/standard/proc_open.c ++++ b/ext/standard/proc_open.c +@@ -62,7 +62,7 @@ + * */ + #ifdef PHP_CAN_SUPPORT_PROC_OPEN + +-#if 0 && HAVE_PTSNAME && HAVE_GRANTPT && HAVE_UNLOCKPT && HAVE_SYS_IOCTL_H && HAVE_TERMIOS_H ++#if HAVE_PTSNAME && HAVE_GRANTPT && HAVE_UNLOCKPT && HAVE_SYS_IOCTL_H && HAVE_TERMIOS_H + # include <sys/ioctl.h> + # include <termios.h> + # define PHP_CAN_DO_PTS 1 +diff --git a/php.ini-development b/php.ini-development +index c8399c4..d7103b2 100644 +--- a/php.ini-development ++++ b/php.ini-development +@@ -295,6 +295,12 @@ + ; and below. This directive makes most sense if used in a per-directory + ; or per-virtualhost web server configuration file. + ; http://php.net/open-basedir ++ ++; NOTE: this is considered a "broken" security measure. ++; Applications relying on this feature will not receive full ++; support by the security team. For more information please ++; see /usr/share/doc/php-common/README.Debian.security ++; + ;open_basedir = + + ; This directive allows you to disable certain functions for security reasons. +diff --git a/ext/dba/config.m4 b/ext/dba/config.m4 +index 740cf14..1e8d51b 100644 +diff --git a/ext/dba/dba.c b/ext/dba/dba.c +index bad12d0..cf9674a 100644 +--- a/ext/dba/dba.c ++++ b/ext/dba/dba.c +@@ -52,6 +52,10 @@ + #include "php_qdbm.h" + #include "php_tcadb.h" + ++#ifdef DB4_INCLUDE_FILE ++#include DB4_INCLUDE_FILE ++#endif ++ + /* {{{ arginfo */ + ZEND_BEGIN_ARG_INFO_EX(arginfo_dba_popen, 0, 0, 2) + ZEND_ARG_INFO(0, path) +@@ -535,6 +539,10 @@ + + php_info_print_table_start(); + php_info_print_table_row(2, "DBA support", "enabled"); ++#ifdef DB_VERSION_STRING ++ php_info_print_table_row(2, "libdb header version", DB_VERSION_STRING); ++ php_info_print_table_row(2, "libdb library version", db_version(NULL, NULL, NULL)); ++#endif + if (handlers.c) { + smart_str_0(&handlers); + php_info_print_table_row(2, "Supported handlers", handlers.c); +diff --git a/ext/mysql/config.m4 b/ext/mysql/config.m4 +index fd7f52e..999c47b 100644 +--- a/ext/mysql/config.m4 ++++ b/ext/mysql/config.m4 +@@ -77,7 +77,7 @@ + Note that the MySQL client library is not bundled anymore!]) + fi + +- if test "$enable_maintainer_zts" = "yes"; then ++ if true || test "$enable_maintainer_zts" = "yes"; then + MYSQL_LIBNAME=mysqlclient_r + else + MYSQL_LIBNAME=mysqlclient +diff --git a/ext/mysqli/config.m4 b/ext/mysqli/config.m4 +index f6c86e7..9192600 100644 +--- a/ext/mysqli/config.m4 ++++ b/ext/mysqli/config.m4 +@@ -26,7 +26,7 @@ + MYSQL_LIB_CFG='--libmysqld-libs' + dnl mysqlnd doesn't support embedded, so we have to add some extra stuff + mysqli_extra_sources="mysqli_embedded.c" +- elif test "$enable_maintainer_zts" = "yes"; then ++ elif true || test "$enable_maintainer_zts" = "yes"; then + MYSQL_LIB_CFG='--libs_r' + MYSQL_LIB_NAME='mysqlclient_r' + else +diff --git a/ext/pdo_mysql/config.m4 b/ext/pdo_mysql/config.m4 +index f237f41..3483cca 100755 +--- a/ext/pdo_mysql/config.m4 ++++ b/ext/pdo_mysql/config.m4 +@@ -55,7 +55,7 @@ + if test "x$SED" = "x"; then + AC_PATH_PROG(SED, sed) + fi +- if test "$enable_maintainer_zts" = "yes"; then ++ if true || test "$enable_maintainer_zts" = "yes"; then + PDO_MYSQL_LIBNAME=mysqlclient_r + PDO_MYSQL_LIBS=`$PDO_MYSQL_CONFIG --libs_r | $SED -e "s/'//g"` + else +--- /dev/null ++++ b/tests/func/null-new_val.phpt +@@ -0,0 +1,10 @@ ++--TEST-- ++ini_restore strcmp NULL new_val ++--FILE-- ++<?php ++ ++ini_set('error_log','ini_set_works'); ++ini_restore('error_log'); ++ ++?> ++--EXPECT-- +diff --git a/build/build.mk b/build/build.mk +index 3eb2616..98e55ea 100644 +--- a/build/build.mk ++++ b/build/build.mk +@@ -63,6 +63,5 @@ + @if (test ! -f '.git/info/exclude' || grep -s "git-ls-files" .git/info/exclude); then \ + (echo "Rebuild .git/info/exclude" && echo '*.o' > .git/info/exclude && git svn propget svn:ignore | grep -v config.nice >> .git/info/exclude); \ + fi; \ +- git clean -X -f -d; + + .PHONY: $(ALWAYS) snapshot +diff --git a/ext/dba/config.m4 b/ext/dba/config.m4 +index 1e8d51b..d2e6fd9 100644 +diff --git a/sapi/fpm/php-fpm.8.in b/sapi/fpm/php-fpm.8.in +index cb1224e..794f508 100644 +--- a/sapi/fpm/php-fpm.8.in ++++ b/sapi/fpm/php-fpm.8.in +@@ -139,22 +139,8 @@ + .TP + .B php.ini + The standard php configuration file. +-.SH EXAMPLES +-For any unix systems which use init.d for their main process manager, you should use the init script provided to start and stop the php-fpm daemon. +-.P +-.PD 1 +-.RS +-sudo /etc/init.d/php-fpm start +-.RE +-.TP +-For any unix systems which use systemd for their main process manager, you should use the unit file provided to start and stop the php-fpm daemon. +-.P +-.PD 1 +-.RS +-sudo systemctl start php-fpm.service +-.RE +-.TP +-If your installation has no appropriate init script, launch php-fpm with no arguments. It will launch as a daemon (background process) by default. The file @php_fpm_localstatedir@/run/php-fpm.pid determines whether php-fpm is already up and running. Once started, php-fpm then responds to several POSIX signals: ++.SH SIGNAL ++Once started, php-fpm then responds to several POSIX signals: + .P + .PD 0 + .RS +@@ -168,10 +154,6 @@ + .RE + .PD 1 + .P +-.SH TIPS +-The PHP-FPM CGI daemon will work well with most popular webservers, including Apache2, lighttpd and nginx. +-.PD 1 +-.P + .SH SEE ALSO + The PHP-FPM website: + .PD 0 +diff --git a/main/streams/plain_wrapper.c b/main/streams/plain_wrapper.c +index f472bad..9805bfc 100644 +--- a/main/streams/plain_wrapper.c ++++ b/main/streams/plain_wrapper.c +@@ -656,7 +656,13 @@ + + switch (value) { + case PHP_STREAM_MMAP_SUPPORTED: +- return fd == -1 ? PHP_STREAM_OPTION_RETURN_ERR : PHP_STREAM_OPTION_RETURN_OK; ++ if (fd == -1) ++ return PHP_STREAM_OPTION_RETURN_ERR; ++ /* Don't mmap large files */ ++ do_fstat(data, 1); ++ if (data->sb.st_size > 4 * 1024 * 1024) ++ return PHP_STREAM_OPTION_RETURN_ERR; ++ return PHP_STREAM_OPTION_RETURN_OK; + + case PHP_STREAM_MMAP_MAP_RANGE: + do_fstat(data, 1); +diff --git a/ext/dba/dba.c b/ext/dba/dba.c +index cf9674a..7554203 100644 +--- a/ext/dba/dba.c ++++ b/ext/dba/dba.c +@@ -930,7 +930,7 @@ + } + } + +- if (error || hptr->open(info, &error TSRMLS_CC) != SUCCESS) { ++ if (error || (hptr->open)(info, &error TSRMLS_CC) != SUCCESS) { + dba_close(info TSRMLS_CC); + php_error_docref2(NULL TSRMLS_CC, Z_STRVAL_PP(args[0]), Z_STRVAL_PP(args[1]), E_WARNING, "Driver initialization failed for handler: %s%s%s", hptr->name, error?": ":"", error?error:""); + FREENOW; +diff --git a/ext/dba/dba_db3.c b/ext/dba/dba_db3.c +index 2d0ad86..ddb2440 100644 +--- a/ext/dba/dba_db3.c ++++ b/ext/dba/dba_db3.c +@@ -91,7 +91,7 @@ + + if ((err=db_create(&dbp, NULL, 0)) == 0) { + dbp->set_errcall(dbp, php_dba_db3_errcall_fcn); +- if ((err=dbp->open(dbp, info->path, NULL, type, gmode, filemode)) == 0) { ++ if ((err=(dbp->open)(dbp, info->path, NULL, type, gmode, filemode)) == 0) { + dba_db3_data *data; + + data = pemalloc(sizeof(*data), info->flags&DBA_PERSISTENT); +diff --git a/ext/dba/dba_db4.c b/ext/dba/dba_db4.c +index 2dfb33a..1aac4cc 100644 +--- a/ext/dba/dba_db4.c ++++ b/ext/dba/dba_db4.c +@@ -126,9 +126,9 @@ + dbp->set_errcall(dbp, php_dba_db4_errcall_fcn); + if ( + #if (DB_VERSION_MAJOR > 4 || (DB_VERSION_MAJOR == 4 && DB_VERSION_MINOR >= 1)) +- (err=dbp->open(dbp, 0, info->path, NULL, type, gmode, filemode)) == 0) { ++ (err=(dbp->open)(dbp, 0, info->path, NULL, type, gmode, filemode)) == 0) { + #else +- (err=dbp->open(dbp, info->path, NULL, type, gmode, filemode)) == 0) { ++ (err=(dbp->open)(dbp, info->path, NULL, type, gmode, filemode)) == 0) { + #endif + dba_db4_data *data; + +diff --git a/ext/zlib/zlib.c b/ext/zlib/zlib.c +index 47dc3ac..69c39df 100644 +--- a/ext/zlib/zlib.c ++++ b/ext/zlib/zlib.c +@@ -46,6 +46,18 @@ + #undef gzseek + #undef gztell + ++/* ++ * zlib include files can define the following preprocessor defines which rename ++ * the corresponding PHP functions to gzopen64, gzseek64 and gztell64 and thereby ++ * breaking some software, most notably PEAR's Archive_Tar, which halts execution ++ * without error message on gzip compressed archivesa. ++ * ++ * This only seems to happen on 32bit systems with large file support. ++ */ ++#undef gzopen ++#undef gzseek ++#undef gztell ++ + ZEND_DECLARE_MODULE_GLOBALS(zlib); + + /* {{{ Memory management wrappers */ +diff --git a/ext/standard/tests/strings/setlocale_variation2.phpt b/ext/standard/tests/strings/setlocale_variation2.phpt +index 5ebdfe8..cadf7a3 100644 +--- a/ext/standard/tests/strings/setlocale_variation2.phpt ++++ b/ext/standard/tests/strings/setlocale_variation2.phpt +@@ -55,6 +55,7 @@ + //try different locale names + $failure_locale = array(); + $success_count = 0; ++$expected = 0; + + echo "-- Test setlocale() with all available locale in the system --\n"; + // gather all locales installed in the system(stored $all_system_locales), +@@ -64,6 +65,10 @@ + if(setlocale(LC_ALL,$value )){ + $success_count++; + } ++ else if ($value == 'no_NO.ISO-8859-1') { ++ // ignore this one, see rhbz #971416 ++ $expected++; ++ } + else{ + //failure values are put in to an array $failure_locale + $failure_locale[] = $value; +@@ -72,11 +77,11 @@ + + echo "No of locales found on the machine = ".count($all_system_locales)."\n"; + echo "No of setlocale() success = ".$success_count."\n"; +-echo "Expected no of failures = 0\n"; ++echo "Expected no of failures = $expected\n"; + echo "Test "; + // check if there were any failure of setlocale() function earlier, if any + // failure then dump the list of failing locales +-if($success_count != count($all_system_locales)){ ++if(($success_count + $expected) != count($all_system_locales)){ + echo "FAILED\n"; + echo "Names of locale() for which setlocale() failed ...\n"; + var_dump($failure_locale); +@@ -92,6 +97,6 @@ + -- Test setlocale() with all available locale in the system -- + No of locales found on the machine = %d + No of setlocale() success = %d +-Expected no of failures = 0 ++Expected no of failures = %d + Test PASSED + Done +diff --git a/ext/pcre/tests/bug37911.phpt b/ext/pcre/tests/bug37911.phpt +index 2b7481a..0d2859d 100644 +--- a/ext/pcre/tests/bug37911.phpt ++++ b/ext/pcre/tests/bug37911.phpt +@@ -37,5 +37,5 @@ + string(4) "blub" + } + +-Warning: preg_replace_callback(): Compilation failed: group name must start with a non-digit at offset %d in %sbug37911.php on line %d ++Warning: preg_replace_callback(): Numeric named subpatterns are not allowed in %sbug37911.php on line %d + NULL +diff --git a/ext/pcre/tests/grep2.phpt b/ext/pcre/tests/grep2.phpt +index 1a8476c..0cf8d4a 100644 +--- a/ext/pcre/tests/grep2.phpt ++++ b/ext/pcre/tests/grep2.phpt +@@ -40,12 +40,6 @@ + string(1) "1" + } + bool(true) +-array(3) { +- [5]=> +- string(1) "a" +- ["xyz"]=> +- string(2) "q6" +- [6]=> +- string(3) "h20" ++array(0) { + } +-bool(false) ++bool(true) +diff --git a/ext/pcre/tests/match_flags3.phpt b/ext/pcre/tests/match_flags3.phpt +index 84deb0b..c1c9d56 100644 +--- a/ext/pcre/tests/match_flags3.phpt ++++ b/ext/pcre/tests/match_flags3.phpt +@@ -42,5 +42,5 @@ + } + } + +-Warning: preg_match(): Compilation failed: group name must start with a non-digit at offset %d in %smatch_flags3.php on line %d ++Warning: preg_match(): Numeric named subpatterns are not allowed in %smatch_flags3.php on line %d + bool(false) +diff --git a/Zend/zend_strtod.c b/Zend/zend_strtod.c +index e74cf0e..7ec0366 100644 +--- a/Zend/zend_strtod.c ++++ b/Zend/zend_strtod.c +@@ -152,14 +152,25 @@ + #define IEEE_LITTLE_ENDIAN + #endif + +-#if defined(__arm__) && !defined(__VFP_FP__) +-/* +- * * Although the CPU is little endian the FP has different +- * * byte and word endianness. The byte order is still little endian +- * * but the word order is big endian. +- * */ +-#define IEEE_BIG_ENDIAN ++#if defined(__arm__) || defined(__thumb__) ++/* ARM traditionally used big-endian words; and within those words the ++ byte ordering was big or little endian depending upon the target. ++ Modern floating-point formats are naturally ordered; in this case ++ __VFP_FP__ will be defined, even if soft-float. */ + #undef IEEE_LITTLE_ENDIAN ++#undef IEEE_BIG_ENDIAN ++#if defined(__VFP_FP__) || defined(__MAVERICK__) ++# ifdef __ARMEL__ ++# define IEEE_LITTLE_ENDIAN ++# else ++# define IEEE_BIG_ENDIAN ++# endif ++#else ++# define IEEE_BIG_ENDIAN ++# ifdef __ARMEL__ ++# define IEEE_BYTES_LITTLE_ENDIAN ++# endif ++#endif + #endif + + #ifdef __vax__ +@@ -287,7 +298,7 @@ + * An alternative that might be better on some machines is + * #define Storeinc(a,b,c) (*a++ = b << 16 | c & 0xffff) + */ +-#if defined(IEEE_LITTLE_ENDIAN) + defined(VAX) + defined(__arm__) ++#if defined(IEEE_LITTLE_ENDIAN) + defined(VAX) + defined(IEEE_BYTES_LITTLE_ENDIAN) + #define Storeinc(a,b,c) (((unsigned short *)a)[1] = (unsigned short)b, \ + ((unsigned short *)a)[0] = (unsigned short)c, a++) + #else +diff --git a/ext/mssql/php_mssql.c b/ext/mssql/php_mssql.c +index 66497f1..6196690 100644 +--- a/ext/mssql/php_mssql.c ++++ b/ext/mssql/php_mssql.c +@@ -178,6 +178,38 @@ + PHP_FE(mssql_execute, arginfo_mssql_execute) + PHP_FE(mssql_free_statement, arginfo_mssql_free_statement) + PHP_FE(mssql_guid_string, arginfo_mssql_guid_string) ++#if !defined(PHP_WIN32) && !defined(HAVE_SYBASE_CT) ++ PHP_FALIAS(sybase_connect, mssql_connect, arginfo_mssql_connect) ++ PHP_FALIAS(sybase_pconnect, mssql_pconnect, arginfo_mssql_connect) ++ PHP_FALIAS(sybase_close, mssql_close, arginfo_mssql_close) ++ PHP_FALIAS(sybase_select_db, mssql_select_db, arginfo_mssql_select_db) ++ PHP_FALIAS(sybase_query, mssql_query, arginfo_mssql_query) ++ PHP_FALIAS(sybase_fetch_batch, mssql_fetch_batch, arginfo_mssql_fetch_batch) ++ PHP_FALIAS(sybase_affected_rows, mssql_rows_affected, arginfo_mssql_rows_affected) ++ PHP_FALIAS(sybase_free_result, mssql_free_result, arginfo_mssql_fetch_batch) ++ PHP_FALIAS(sybase_get_last_message, mssql_get_last_message, arginfo_mssql_get_last_message) ++ PHP_FALIAS(sybase_num_rows, mssql_num_rows, arginfo_mssql_fetch_batch) ++ PHP_FALIAS(sybase_num_fields, mssql_num_fields, arginfo_mssql_fetch_batch) ++ PHP_FALIAS(sybase_fetch_field, mssql_fetch_field, arginfo_mssql_fetch_field) ++ PHP_FALIAS(sybase_fetch_row, mssql_fetch_row, arginfo_mssql_fetch_batch) ++ PHP_FALIAS(sybase_fetch_array, mssql_fetch_array, arginfo_mssql_fetch_array) ++ PHP_FALIAS(sybase_fetch_assoc, mssql_fetch_assoc, arginfo_mssql_fetch_assoc) ++ PHP_FALIAS(sybase_fetch_object, mssql_fetch_object, arginfo_mssql_fetch_batch) ++ PHP_FALIAS(sybase_field_length, mssql_field_length, arginfo_mssql_field_length) ++ PHP_FALIAS(sybase_field_name, mssql_field_name, arginfo_mssql_field_length) ++ PHP_FALIAS(sybase_field_type, mssql_field_type, arginfo_mssql_field_length) ++ PHP_FALIAS(sybase_data_seek, mssql_data_seek, arginfo_mssql_data_seek) ++ PHP_FALIAS(sybase_field_seek, mssql_field_seek, arginfo_mssql_fetch_field) ++ PHP_FALIAS(sybase_result, mssql_result, arginfo_mssql_result) ++ PHP_FALIAS(sybase_next_result, mssql_next_result, arginfo_mssql_fetch_assoc) ++ PHP_FALIAS(sybase_min_error_severity, mssql_min_error_severity, arginfo_mssql_min_error_severity) ++ PHP_FALIAS(sybase_min_message_severity, mssql_min_message_severity, arginfo_mssql_min_error_severity) ++ PHP_FALIAS(sybase_init, mssql_init, arginfo_mssql_init) ++ PHP_FALIAS(sybase_bind, mssql_bind, arginfo_mssql_bind) ++ PHP_FALIAS(sybase_execute, mssql_execute, arginfo_mssql_execute) ++ PHP_FALIAS(sybase_free_statement, mssql_free_statement, arginfo_mssql_free_statement) ++ PHP_FALIAS(sybase_guid_string, mssql_guid_string, arginfo_mssql_guid_string) ++#endif + PHP_FE_END + }; + /* }}} */ +diff --git a/Zend/zend.h b/Zend/zend.h +index 35fa013..3d93018 100644 +--- a/Zend/zend.h ++++ b/Zend/zend.h +@@ -90,11 +90,11 @@ + # endif + + # if defined(RTLD_GROUP) && defined(RTLD_WORLD) && defined(RTLD_PARENT) +-# define DL_LOAD(libname) dlopen(libname, RTLD_LAZY | RTLD_GLOBAL | RTLD_GROUP | RTLD_WORLD | RTLD_PARENT) ++# define DL_LOAD(libname) dlopen(libname, RTLD_NOW | RTLD_GLOBAL | RTLD_GROUP | RTLD_WORLD | RTLD_PARENT) + # elif defined(RTLD_DEEPBIND) +-# define DL_LOAD(libname) dlopen(libname, RTLD_LAZY | RTLD_GLOBAL | RTLD_DEEPBIND) ++# define DL_LOAD(libname) dlopen(libname, RTLD_NOW | RTLD_GLOBAL | RTLD_DEEPBIND) + # else +-# define DL_LOAD(libname) dlopen(libname, RTLD_LAZY | RTLD_GLOBAL) ++# define DL_LOAD(libname) dlopen(libname, RTLD_NOW | RTLD_GLOBAL) + # endif + # define DL_UNLOAD dlclose + # if defined(DLSYM_NEEDS_UNDERSCORE) +diff --git a/sapi/apache2handler/config.m4 b/sapi/apache2handler/config.m4 +index f170ea9..3b280dd 100644 +--- a/sapi/apache2handler/config.m4 ++++ b/sapi/apache2handler/config.m4 +@@ -69,7 +69,7 @@ + \$(mkinstalldirs) '$APXS_SYSCONFDIR' && \ + $APXS -S LIBEXECDIR='$APXS_LIBEXECDIR' \ + -S SYSCONFDIR='$APXS_SYSCONFDIR' \ +- -i -a -n php5" ++ -i -n php5" + fi + + case $host_alias in +diff --git a/ext/mysql/php_mysql.c b/ext/mysql/php_mysql.c +index 2d3ba60..679d417 100644 +--- a/ext/mysql/php_mysql.c ++++ b/ext/mysql/php_mysql.c +@@ -735,13 +735,13 @@ + E_DEPRECATED, + "The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead"); + +-#if !defined(MYSQL_USE_MYSQLND) +- if ((MYSQL_VERSION_ID / 100) != (mysql_get_client_version() / 100)) { +- php_error_docref(NULL TSRMLS_CC, E_WARNING, +- "Headers and client library minor version mismatch. Headers:%d Library:%ld", +- MYSQL_VERSION_ID, mysql_get_client_version()); +- } +-#endif ++/* #if !defined(MYSQL_USE_MYSQLND) */ ++/* if ((MYSQL_VERSION_ID / 100) != (mysql_get_client_version() / 100)) { */ ++/* php_error_docref(NULL TSRMLS_CC, E_WARNING, */ ++/* "Headers and client library minor version mismatch. Headers:%d Library:%ld", */ ++/* MYSQL_VERSION_ID, mysql_get_client_version()); */ ++/* } */ ++/* #endif */ + + connect_timeout = MySG(connect_timeout); + +diff --git a/ext/mysqli/mysqli_nonapi.c b/ext/mysqli/mysqli_nonapi.c +index f1e805c..9ebdca1 100644 +--- a/ext/mysqli/mysqli_nonapi.c ++++ b/ext/mysqli/mysqli_nonapi.c +@@ -74,13 +74,13 @@ + zend_bool self_alloced = 0; + + +-#if !defined(MYSQL_USE_MYSQLND) +- if ((MYSQL_VERSION_ID / 100) != (mysql_get_client_version() / 100)) { +- php_error_docref(NULL TSRMLS_CC, E_WARNING, +- "Headers and client library minor version mismatch. Headers:%d Library:%ld", +- MYSQL_VERSION_ID, mysql_get_client_version()); +- } +-#endif ++/* #if !defined(MYSQL_USE_MYSQLND) */ ++/* if ((MYSQL_VERSION_ID / 100) != (mysql_get_client_version() / 100)) { */ ++/* php_error_docref(NULL TSRMLS_CC, E_WARNING, */ ++/* "Headers and client library minor version mismatch. Headers:%d Library:%ld", */ ++/* MYSQL_VERSION_ID, mysql_get_client_version()); */ ++/* } */ ++/* #endif */ + + if (getThis() && !ZEND_NUM_ARGS() && in_ctor) { + php_mysqli_init(INTERNAL_FUNCTION_PARAM_PASSTHRU); +diff --git a/ext/tidy/tidy.c b/ext/tidy/tidy.c +index 57f050b..4af30f2 100644 +--- a/ext/tidy/tidy.c ++++ b/ext/tidy/tidy.c +@@ -31,7 +31,7 @@ + #include "ext/standard/info.h" + + #include "tidy.h" +-#include "buffio.h" ++#include "tidybuffio.h" + + /* compatibility with older versions of libtidy */ + #ifndef TIDY_CALL +diff --git a/ext/curl/config.m4 b/ext/curl/config.m4 +index 2f82c34..f785770 100644 +--- a/ext/curl/config.m4 ++++ b/ext/curl/config.m4 +@@ -6,12 +6,12 @@ + [ --with-curl[=DIR] Include cURL support]) + + if test "$PHP_CURL" != "no"; then +- if test -r $PHP_CURL/include/curl/easy.h; then ++ if test -r $PHP_CURL/include/$DEB_HOST_MULTIARCH/curl/easy.h || test -r $PHP_CURL/include/curl/easy.h; then + CURL_DIR=$PHP_CURL + else + AC_MSG_CHECKING(for cURL in default path) + for i in /usr/local /usr; do +- if test -r $i/include/curl/easy.h; then ++ if test -r $i/include/$DEB_HOST_MULTIARCH/curl/easy.h || test -r $i/include/curl/easy.h; then + CURL_DIR=$i + AC_MSG_RESULT(found in $i) + break +diff --git a/Zend/zend_gc.c b/Zend/zend_gc.c +index e72655c..e7c5098 100644 +--- a/Zend/zend_gc.c ++++ b/Zend/zend_gc.c +@@ -310,16 +310,25 @@ + } + } + while (p != NULL) { +- pz = *(zval**)p->pData; +- if (Z_TYPE_P(pz) != IS_ARRAY || Z_ARRVAL_P(pz) != &EG(symbol_table)) { +- pz->refcount__gc++; +- } +- if (GC_ZVAL_GET_COLOR(pz) != GC_BLACK) { +- if (p->pListNext == NULL) { +- goto tail_call; ++ if (p->pData != NULL) { ++ pz = *(zval**)p->pData; ++ if (pz != NULL) { ++ if (Z_TYPE_P(pz) != IS_ARRAY || Z_ARRVAL_P(pz) != &EG(symbol_table)) { ++ pz->refcount__gc++; ++ } ++ if (GC_ZVAL_GET_COLOR(pz) != GC_BLACK) { ++ if (p->pListNext == NULL) { ++ goto tail_call; ++ } else { ++ zval_scan_black(pz TSRMLS_CC); ++ } ++ } + } else { +- zval_scan_black(pz TSRMLS_CC); ++ /* Now this is really odd ... we've got a p->pData which references a NULL pointer */ + } ++ } else { ++ /* shall we log something when encountering a p->pData == NULL */ ++ + } + p = p->pListNext; + } +@@ -353,12 +362,20 @@ + } + p = props->pListHead; + while (p != NULL) { +- pz = *(zval**)p->pData; +- if (Z_TYPE_P(pz) != IS_ARRAY || Z_ARRVAL_P(pz) != &EG(symbol_table)) { +- pz->refcount__gc++; +- } +- if (GC_ZVAL_GET_COLOR(pz) != GC_BLACK) { +- zval_scan_black(pz TSRMLS_CC); ++ if (p->pData != NULL) { ++ pz = *(zval**)p->pData; ++ if (pz != NULL) { ++ if (Z_TYPE_P(pz) != IS_ARRAY || Z_ARRVAL_P(pz) != &EG(symbol_table)) { ++ pz->refcount__gc++; ++ } ++ if (GC_ZVAL_GET_COLOR(pz) != GC_BLACK) { ++ zval_scan_black(pz TSRMLS_CC); ++ } ++ } else { ++ /* pz is NULL - maybe there should be some logging? */ ++ } ++ } else { ++ /* p->pData is NULL - maybe there should be some logging? */ + } + p = p->pListNext; + } +@@ -417,14 +434,23 @@ + } + } + while (p != NULL) { +- pz = *(zval**)p->pData; +- if (Z_TYPE_P(pz) != IS_ARRAY || Z_ARRVAL_P(pz) != &EG(symbol_table)) { +- pz->refcount__gc--; +- } +- if (p->pListNext == NULL) { +- goto tail_call; ++ if (p->pData != NULL) { ++ pz = *(zval**)p->pData; ++ if (pz != NULL) { ++ if (Z_TYPE_P(pz) != IS_ARRAY || Z_ARRVAL_P(pz) != &EG(symbol_table)) { ++ pz->refcount__gc--; ++ } ++ if (p->pListNext == NULL) { ++ goto tail_call; ++ } else { ++ zval_mark_grey(pz TSRMLS_CC); ++ } ++ } else { ++ /* Now this is odd - we have a valid pz and a pData which is NULL */ ++ ++ } + } else { +- zval_mark_grey(pz TSRMLS_CC); ++ /* Some logging maybe? p->pData is NULL */ + } + p = p->pListNext; + } +@@ -459,11 +485,19 @@ + } + p = props->pListHead; + while (p != NULL) { +- pz = *(zval**)p->pData; +- if (Z_TYPE_P(pz) != IS_ARRAY || Z_ARRVAL_P(pz) != &EG(symbol_table)) { +- pz->refcount__gc--; ++ if (p->pData != NULL) { ++ pz = *(zval**)p->pData; ++ if (pz != NULL) { ++ if (Z_TYPE_P(pz) != IS_ARRAY || Z_ARRVAL_P(pz) != &EG(symbol_table)) { ++ pz->refcount__gc--; ++ } ++ zval_mark_grey(pz TSRMLS_CC); ++ } else { ++ /* TODO: Some logging maybe? */ ++ } ++ } else { ++ /* TODO: Some logging maybe? */ + } +- zval_mark_grey(pz TSRMLS_CC); + p = p->pListNext; + } + } +diff --git a/ext/phar/phar.c b/ext/phar/phar.c +index 6e5cec2..850a6e6 100644 +--- a/ext/phar/phar.c ++++ b/ext/phar/phar.c +@@ -1385,6 +1385,9 @@ + /* set up our manifest */ + mydata = ecalloc(1, sizeof(phar_archive_data)); + mydata->fname = expand_filepath(fname, NULL TSRMLS_CC); ++ if (mydata->fname == NULL) { ++ return FAILURE; ++ } + fname_len = strlen(mydata->fname); + #ifdef PHP_WIN32 + phar_unixify_path_separators(mydata->fname, fname_len); +--- /dev/null ++++ b/ext/phar/tests/bug77396.phpt +@@ -0,0 +1,15 @@ ++--TEST-- ++Bug #77396 Relative filename exceeding maximum path length causes null pointer dereference. ++--SKIPIF-- ++<?php if (!extension_loaded("phar")) die("skip"); ?> ++--FILE-- ++<?php ++$path = '../' . str_repeat("x", PHP_MAXPATHLEN) . '.tar'; ++$phar = new PharData($path); ++?> ++--EXPECTF-- ++Fatal error: Uncaught UnexpectedValueException: Phar creation or opening failed in %s/bug77396.php:%d ++Stack trace: ++#0 %s/bug77396.php(%d): PharData->__construct(%s) ++#1 {main} ++ thrown in %s/bug77396.php on line %d +diff --git a/ext/spl/spl_directory.c b/ext/spl/spl_directory.c +index c083345..fbcf892 100644 +--- a/ext/spl/spl_directory.c ++++ b/ext/spl/spl_directory.c +@@ -1135,7 +1135,7 @@ + + zend_replace_error_handling(EH_THROW, spl_ce_RuntimeException, &error_handling TSRMLS_CC); + +- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &path, &len) == FAILURE) { ++ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p", &path, &len) == FAILURE) { + zend_restore_error_handling(&error_handling TSRMLS_CC); + return; + } +--- /dev/null ++++ b/ext/spl/tests/bug77431.phpt +@@ -0,0 +1,9 @@ ++--TEST-- ++Bug #77431 (SplFileInfo::__construct() accepts NUL bytes) ++--FILE-- ++<?php ++new SplFileInfo("bad\0good"); ++?> ++--EXPECTF-- ++Fatal error: Uncaught TypeError: SplFileInfo::__construct() expects parameter 1 to be a valid path, string given in %s:%d ++Stack trace:%A +\ No newline at end of file +diff --git a/ext/exif/exif.c b/ext/exif/exif.c +index cad29b7..47055a1 100644 +--- a/ext/exif/exif.c ++++ b/ext/exif/exif.c +@@ -3577,10 +3577,10 @@ + tag_table_type tag_table = exif_get_tag_table(section_index); + + if (ImageInfo->ifd_nesting_level > MAX_IFD_NESTING_LEVEL) { +- return FALSE; +- } ++ return FALSE; ++ } + +- if (ImageInfo->FileSize >= dir_offset+2) { ++ if (ImageInfo->FileSize >= 2 && ImageInfo->FileSize - 2 >= dir_offset) { + sn = exif_file_sections_add(ImageInfo, M_PSEUDO, 2, NULL); + #ifdef EXIF_DEBUG + exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_NOTICE, "Read from TIFF: filesize(x%04X), IFD dir(x%04X + x%04X)", ImageInfo->FileSize, dir_offset, 2); +@@ -3588,8 +3588,8 @@ + php_stream_seek(ImageInfo->infile, dir_offset, SEEK_SET); /* we do not know the order of sections */ + php_stream_read(ImageInfo->infile, (char*)ImageInfo->file.list[sn].data, 2); + num_entries = php_ifd_get16u(ImageInfo->file.list[sn].data, ImageInfo->motorola_intel); +- dir_size = 2/*num dir entries*/ +12/*length of entry*/*num_entries +4/* offset to next ifd (points to thumbnail or NULL)*/; +- if (ImageInfo->FileSize >= dir_offset+dir_size) { ++ dir_size = 2/*num dir entries*/ +12/*length of entry*/*(size_t)num_entries +4/* offset to next ifd (points to thumbnail or NULL)*/; ++ if (ImageInfo->FileSize >= dir_size && ImageInfo->FileSize - dir_size >= dir_offset) { + #ifdef EXIF_DEBUG + exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_NOTICE, "Read from TIFF: filesize(x%04X), IFD dir(x%04X + x%04X), IFD entries(%d)", ImageInfo->FileSize, dir_offset+2, dir_size-2, num_entries); + #endif +@@ -3672,9 +3672,9 @@ + } + } + } +- if (ImageInfo->FileSize >= dir_offset + ImageInfo->file.list[sn].size) { ++ if (ImageInfo->FileSize >= ImageInfo->file.list[sn].size && ImageInfo->FileSize - ImageInfo->file.list[sn].size >= dir_offset) { + if (ifd_size > dir_size) { +- if (dir_offset + ifd_size > ImageInfo->FileSize) { ++ if (ImageInfo->FileSize < ifd_size || dir_offset > ImageInfo->FileSize - ifd_size) { + exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_WARNING, "Error in TIFF: filesize(x%04X) less than size of IFD(x%04X + x%04X)", ImageInfo->FileSize, dir_offset, ifd_size); + return FALSE; + } +diff --git a/ext/exif/exif.c b/ext/exif/exif.c +index 47055a1..5497068 100644 +--- a/ext/exif/exif.c ++++ b/ext/exif/exif.c +@@ -3519,7 +3519,7 @@ + return FALSE; + marker = c; + length = php_jpg_get16(data+pos); +- if (pos+length>=ImageInfo->Thumbnail.size) { ++ if (length > ImageInfo->Thumbnail.size || pos >= ImageInfo->Thumbnail.size - length) { + return FALSE; + } + #ifdef EXIF_DEBUG +@@ -3540,6 +3540,10 @@ + case M_SOF14: + case M_SOF15: + /* handle SOFn block */ ++ if (length < 8 || ImageInfo->Thumbnail.size - 8 < pos) { ++ /* exif_process_SOFn needs 8 bytes */ ++ return FALSE; ++ } + exif_process_SOFn(data+pos, marker, &sof_info); + ImageInfo->Thumbnail.height = sof_info.height; + ImageInfo->Thumbnail.width = sof_info.width; +@@ -4183,7 +4187,9 @@ + ZVAL_STRINGL(return_value, ImageInfo.Thumbnail.data, ImageInfo.Thumbnail.size, 1); + if (arg_c >= 3) { + if (!ImageInfo.Thumbnail.width || !ImageInfo.Thumbnail.height) { +- exif_scan_thumbnail(&ImageInfo TSRMLS_CC); ++ if (!exif_scan_thumbnail(&ImageInfo TSRMLS_CC)) { ++ ImageInfo.Thumbnail.width = ImageInfo.Thumbnail.height = 0; ++ } + } + zval_dtor(p_width); + zval_dtor(p_height); +--- /dev/null ++++ b/ext/exif/tests/bug77540.jpg +@@ -0,0 +1 @@ ++ÿØá +\ No newline at end of file +--- /dev/null ++++ b/ext/exif/tests/bug77540.phpt +@@ -0,0 +1,16 @@ ++--TEST-- ++Bug 77540 (Invalid Read on exif_process_SOFn) ++--SKIPIF-- ++<?php if (!extension_loaded('exif')) print 'skip exif extension not available';?> ++--FILE-- ++<?php ++$width = $height = 42; ++$s = exif_thumbnail(__DIR__."/bug77540.jpg", $width, $height); ++echo "Width ".$width."\n"; ++echo "Height ".$height."\n"; ++?> ++DONE ++--EXPECTF-- ++Width 0 ++Height 0 ++DONE +\ No newline at end of file +diff --git a/ext/exif/exif.c b/ext/exif/exif.c +index 5497068..ce8db17 100644 +--- a/ext/exif/exif.c ++++ b/ext/exif/exif.c +@@ -2751,7 +2751,7 @@ + break; + } + +- if (maker_note->offset >= value_len) { ++ if (value_len < 2 || maker_note->offset >= value_len - 1) { + /* Do not go past the value end */ + exif_error_docref("exif_read_data#error_ifd" EXIFERR_CC, ImageInfo, E_WARNING, "IFD data too short: 0x%04X offset 0x%04X", value_len, maker_note->offset); + return FALSE; +@@ -2804,6 +2804,7 @@ + break; + default: + case MN_OFFSET_NORMAL: ++ data_len = value_len; + break; + } + +--- /dev/null ++++ b/ext/exif/tests/bug77563.jpg +@@ -0,0 +1 @@ ++ÿØá +\ No newline at end of file +--- /dev/null ++++ b/ext/exif/tests/bug77563.phpt +@@ -0,0 +1,16 @@ ++--TEST-- ++Bug 77563 (Uninitialized read in exif_process_IFD_in_MAKERNOTE) ++--SKIPIF-- ++<?php if (!extension_loaded('exif')) print 'skip exif extension not available';?> ++--FILE-- ++<?php ++$s = exif_thumbnail(__DIR__."/bug77563.jpg"); ++?> ++DONE ++--EXPECTF-- ++Warning: exif_thumbnail(bug77563.jpg): Illegal IFD offset in %s/bug77563.php on line %d ++ ++Warning: exif_thumbnail(bug77563.jpg): File structure corrupted in %s/bug77563.php on line %d ++ ++Warning: exif_thumbnail(bug77563.jpg): Invalid JPEG file in %s/bug77563.php on line %d ++DONE +\ No newline at end of file +diff --git a/ext/phar/tar.c b/ext/phar/tar.c +index 898ff85..7ad95eb 100644 +--- a/ext/phar/tar.c ++++ b/ext/phar/tar.c +@@ -765,7 +765,12 @@ + header.typeflag = entry->tar_type; + + if (entry->link) { +- strncpy(header.linkname, entry->link, strlen(entry->link)); ++ if (strlcpy(header.linkname, entry->link, sizeof(header.linkname)) >= sizeof(header.linkname)) { ++ if (fp->error) { ++ spprintf(fp->error, 4096, "tar-based phar \"%s\" cannot be created, link \"%s\" is too long for format", entry->phar->fname, entry->link); ++ } ++ return ZEND_HASH_APPLY_STOP; ++ } + } + + strncpy(header.magic, "ustar", sizeof("ustar")-1); +diff --git a/main/streams/plain_wrapper.c b/main/streams/plain_wrapper.c +index 9805bfc..a5a09e2 100644 +--- a/main/streams/plain_wrapper.c ++++ b/main/streams/plain_wrapper.c +@@ -1132,34 +1132,50 @@ + # ifdef EXDEV + if (errno == EXDEV) { + struct stat sb; ++# if !defined(ZTS) && !defined(TSRM_WIN32) && !defined(NETWARE) ++ /* not sure what to do in ZTS case, umask is not thread-safe */ ++ int oldmask = umask(077); ++# endif ++ int success = 0; + if (php_copy_file(url_from, url_to TSRMLS_CC) == SUCCESS) { + if (VCWD_STAT(url_from, &sb) == 0) { ++ success = 1; + # if !defined(TSRM_WIN32) && !defined(NETWARE) +- if (VCWD_CHMOD(url_to, sb.st_mode)) { ++ /* ++ * Try to set user and permission info on the target. ++ * If we're not root, then some of these may fail. ++ * We try chown first, to set proper group info, relying ++ * on the system environment to have proper umask to not allow ++ * access to the file in the meantime. ++ */ ++ if (VCWD_CHOWN(url_to, sb.st_uid, sb.st_gid)) { ++ php_error_docref2(NULL TSRMLS_CC, url_from, url_to, E_WARNING, "%s", strerror(errno)); + if (errno == EPERM) { +- php_error_docref2(NULL TSRMLS_CC, url_from, url_to, E_WARNING, "%s", strerror(errno)); +- VCWD_UNLINK(url_from); +- return 1; ++ success = 0; + } +- php_error_docref2(NULL TSRMLS_CC, url_from, url_to, E_WARNING, "%s", strerror(errno)); +- return 0; + } +- if (VCWD_CHOWN(url_to, sb.st_uid, sb.st_gid)) { +- if (errno == EPERM) { ++ if (success) { ++ if (VCWD_CHMOD(url_to, sb.st_mode)) { + php_error_docref2(NULL TSRMLS_CC, url_from, url_to, E_WARNING, "%s", strerror(errno)); +- VCWD_UNLINK(url_from); +- return 1; ++ if (errno == EPERM) { ++ success = 0; ++ } + } +- php_error_docref2(NULL TSRMLS_CC, url_from, url_to, E_WARNING, "%s", strerror(errno)); +- return 0; + } + # endif +- VCWD_UNLINK(url_from); +- return 1; ++ if (success) { ++ VCWD_UNLINK(url_from); ++ } ++ } else { ++ php_error_docref2(NULL TSRMLS_CC, url_from, url_to, E_WARNING, "%s", strerror(errno)); + } ++ } else { ++ php_error_docref2(NULL TSRMLS_CC, url_from, url_to, E_WARNING, "%s", strerror(errno)); + } +- php_error_docref2(NULL TSRMLS_CC, url_from, url_to, E_WARNING, "%s", strerror(errno)); +- return 0; ++# if !defined(ZTS) && !defined(TSRM_WIN32) && !defined(NETWARE) ++ umask(oldmask); ++# endif ++ return success; + } + # endif + #endif +diff --git a/ext/readline/config.m4 b/ext/readline/config.m4 +index 0a00370..b0cefcc 100644 +--- a/ext/readline/config.m4 ++++ b/ext/readline/config.m4 +@@ -67,6 +67,13 @@ + -L$READLINE_DIR/$PHP_LIBDIR $PHP_READLINE_LIBS + ]) + ++ PHP_CHECK_LIBRARY(readline, rl_completion_matches, ++ [ ++ AC_DEFINE(HAVE_RL_COMPLETION_MATCHES, 1, [ ]) ++ ],[],[ ++ -L$READLINE_DIR/$PHP_LIBDIR $PHP_READLINE_LIBS ++ ]) ++ + AC_DEFINE(HAVE_LIBREADLINE, 1, [ ]) + + elif test "$PHP_LIBEDIT" != "no"; then +@@ -114,11 +121,17 @@ + -L$READLINE_DIR/$PHP_LIBDIR + ]) + ++ PHP_CHECK_LIBRARY(edit, rl_completion_matches, ++ [ ++ AC_DEFINE(HAVE_RL_COMPLETION_MATCHES, 1, [ ]) ++ ],[],[ ++ -L$READLINE_DIR/$PHP_LIBDIR $PHP_READLINE_LIBS ++ ]) ++ + AC_DEFINE(HAVE_LIBEDIT, 1, [ ]) + fi + + if test "$PHP_READLINE" != "no" || test "$PHP_LIBEDIT" != "no"; then +- AC_CHECK_FUNCS([rl_completion_matches]) + PHP_NEW_EXTENSION(readline, readline.c readline_cli.c, $ext_shared, cli) + PHP_SUBST(READLINE_SHARED_LIBADD) + fi +diff --git a/ext/exif/exif.c b/ext/exif/exif.c +index ce8db17..4350124 100644 +--- a/ext/exif/exif.c ++++ b/ext/exif/exif.c +@@ -2812,6 +2812,10 @@ + exif_error_docref("exif_read_data#error_ifd" EXIFERR_CC, ImageInfo, E_WARNING, "Illegal IFD size: 2 + 0x%04X*12 = 0x%04X > 0x%04X", NumDirEntries, 2+NumDirEntries*12, value_len); + return FALSE; + } ++ if ((dir_start - value_ptr) > value_len - (2+NumDirEntries*12)) { ++ exif_error_docref("exif_read_data#error_ifd" EXIFERR_CC, ImageInfo, E_WARNING, "Illegal IFD size: 0x%04X > 0x%04X", (dir_start - value_ptr) + (2+NumDirEntries*12), value_len); ++ return FALSE; ++ } + + for (de=0;de<NumDirEntries;de++) { + if (!exif_process_IFD_TAG(ImageInfo, dir_start + 2 + 12 * de, +--- /dev/null ++++ b/ext/exif/tests/bug77753.phpt +@@ -0,0 +1,16 @@ ++--TEST-- ++Bug #77753 (Heap-buffer-overflow in php_ifd_get32s) ++--SKIPIF-- ++<?php if (!extension_loaded('exif')) print 'skip exif extension not available';?> ++--FILE-- ++<?php ++var_dump(exif_read_data(__DIR__."/bug77753.tiff")); ++?> ++DONE ++--EXPECTF-- ++%A ++Warning: exif_read_data(bug77753.tiff): Illegal IFD size: 0x006A > 0x0065 in %sbug77753.php on line %d ++ ++Warning: exif_read_data(bug77753.tiff): Invalid TIFF file in %sbug77753.php on line %d ++bool(false) ++DONE +\ No newline at end of file +--- /dev/null ++++ b/ext/exif/tests/bug77753.tiff +@@ -0,0 +1 @@ ++II* +\ No newline at end of file +--- a/ext/exif/exif.c ++++ b/ext/exif/exif.c +@@ -1660,10 +1660,10 @@ + /* {{{ exif_iif_add_value + Add a value to image_info + */ +-static void exif_iif_add_value(image_info_type *image_info, int section_index, char *name, int tag, int format, int length, void* value, int motorola_intel TSRMLS_DC) ++static void exif_iif_add_value(image_info_type *image_info, int section_index, char *name, int tag, int format, int length, void* value, size_t value_len, int motorola_intel TSRMLS_DC) + { + size_t idex; +- void *vptr; ++ void *vptr, *vptr_end; + image_info_value *info_value; + image_info_data *info_data; + image_info_data *list; +@@ -1685,8 +1685,12 @@ + + switch (format) { + case TAG_FMT_STRING: ++ if (length > value_len) { ++ exif_error_docref("exif_iif_add_value" EXIFERR_CC, image_info, E_WARNING, "length > value_len: %d > %zu", length, value_len); ++ value = NULL; ++ } + if (value) { +- length = php_strnlen(value, length); ++ length = (int)php_strnlen(value, length); + info_value->s = estrndup(value, length); + info_data->length = length; + } else { +@@ -1708,6 +1712,10 @@ + if (!length) + break; + case TAG_FMT_UNDEFINED: ++ if (length > value_len) { ++ exif_error_docref("exif_iif_add_value" EXIFERR_CC, image_info, E_WARNING, "length > value_len: %d > %zu", length, value_len); ++ value = NULL; ++ } + if (value) { + if (tag == TAG_MAKER_NOTE) { + length = (int) php_strnlen(value, length); +@@ -1738,7 +1746,12 @@ + } else { + info_value = &info_data->value; + } ++ vptr_end = value+value_len; + for (idex=0,vptr=value; idex<(size_t)length; idex++,vptr=(char *) vptr + php_tiff_bytes_per_format[format]) { ++ if (vptr_end - vptr < php_tiff_bytes_per_format[format]) { ++ exif_error_docref("exif_iif_add_value" EXIFERR_CC, image_info, E_WARNING, "Value too short"); ++ break; ++ } + if (length>1) { + info_value = &info_data->value.list[idex]; + } +@@ -1774,7 +1787,7 @@ + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Found value of type single"); + #endif + info_value->f = *(float *)value; +- ++ break; + case TAG_FMT_DOUBLE: + #ifdef EXIF_DEBUG + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Found value of type double"); +@@ -1792,9 +1805,9 @@ + /* {{{ exif_iif_add_tag + Add a tag from IFD to image_info + */ +-static void exif_iif_add_tag(image_info_type *image_info, int section_index, char *name, int tag, int format, size_t length, void* value TSRMLS_DC) ++static void exif_iif_add_tag(image_info_type *image_info, int section_index, char *name, int tag, int format, size_t length, void* value, size_t value_len TSRMLS_DC) + { +- exif_iif_add_value(image_info, section_index, name, tag, format, (int)length, value, image_info->motorola_intel TSRMLS_CC); ++ exif_iif_add_value(image_info, section_index, name, tag, format, (int)length, value, value_len, image_info->motorola_intel TSRMLS_CC); + } + /* }}} */ + +@@ -2218,7 +2231,7 @@ + */ + static void exif_process_COM (image_info_type *image_info, char *value, size_t length TSRMLS_DC) + { +- exif_iif_add_tag(image_info, SECTION_COMMENT, "Comment", TAG_COMPUTED_VALUE, TAG_FMT_STRING, length-2, value+2 TSRMLS_CC); ++ exif_iif_add_tag(image_info, SECTION_COMMENT, "Comment", TAG_COMPUTED_VALUE, TAG_FMT_STRING, length-2, value+2, length-2 TSRMLS_CC); + } + /* }}} */ + +@@ -2233,17 +2246,17 @@ + if (length>3) { + switch(value[2]) { + case 0: +- exif_iif_add_tag(image_info, SECTION_COMMENT, "Comment", TAG_COMPUTED_VALUE, TAG_FMT_UNDEFINED, length, value TSRMLS_CC); ++ exif_iif_add_tag(image_info, SECTION_COMMENT, "Comment", TAG_COMPUTED_VALUE, TAG_FMT_UNDEFINED, length, value, length TSRMLS_CC); + break; + case 1: +- exif_iif_add_tag(image_info, SECTION_COMMENT, "Comment", TAG_COMPUTED_VALUE, TAG_FMT_STRING, length, value); ++ exif_iif_add_tag(image_info, SECTION_COMMENT, "Comment", TAG_COMPUTED_VALUE, TAG_FMT_STRING, length, value, length); + break; + default: + php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Undefined JPEG2000 comment encoding"); + break; + } + } else { +- exif_iif_add_tag(image_info, SECTION_COMMENT, "Comment", TAG_COMPUTED_VALUE, TAG_FMT_UNDEFINED, 0, NULL); ++ exif_iif_add_tag(image_info, SECTION_COMMENT, "Comment", TAG_COMPUTED_VALUE, TAG_FMT_UNDEFINED, 0, NULL, 0 TSRMLS_CC); + php_error_docref(NULL TSRMLS_CC, E_NOTICE, "JPEG2000 comment section too small"); + } + } +@@ -2837,7 +2850,7 @@ + static int exif_process_IFD_TAG(image_info_type *ImageInfo, char *dir_entry, char *offset_base, size_t IFDlength, size_t displacement, int section_index, int ReadNextIFD, tag_table_type tag_table TSRMLS_DC) + { + size_t length; +- int tag, format, components; ++ unsigned int tag, format, components; + char *value_ptr, tagname[64], cbuf[32], *outside=NULL; + size_t byte_count, offset_val, fpos, fgot; + int64_t byte_count_signed; +@@ -3148,7 +3161,7 @@ + } + } + } +- exif_iif_add_tag(ImageInfo, section_index, exif_get_tagname(tag, tagname, sizeof(tagname), tag_table TSRMLS_CC), tag, format, components, value_ptr TSRMLS_CC); ++ exif_iif_add_tag(ImageInfo, section_index, exif_get_tagname(tag, tagname, sizeof(tagname), tag_table TSRMLS_CC), tag, format, components, value_ptr, byte_count TSRMLS_CC); + EFREE_IF(outside); + return TRUE; + } +@@ -3306,10 +3319,10 @@ + size_t l1, l2=0; + + if ((l1 = php_strnlen(buffer+2, length-2)) > 0) { +- exif_iif_add_tag(ImageInfo, SECTION_APP12, "Company", TAG_NONE, TAG_FMT_STRING, l1, buffer+2 TSRMLS_CC); ++ exif_iif_add_tag(ImageInfo, SECTION_APP12, "Company", TAG_NONE, TAG_FMT_STRING, l1, buffer+2, l1 TSRMLS_CC); + if (length > 2+l1+1) { + l2 = php_strnlen(buffer+2+l1+1, length-2-l1-1); +- exif_iif_add_tag(ImageInfo, SECTION_APP12, "Info", TAG_NONE, TAG_FMT_STRING, l2, buffer+2+l1+1 TSRMLS_CC); ++ exif_iif_add_tag(ImageInfo, SECTION_APP12, "Info", TAG_NONE, TAG_FMT_STRING, l2, buffer+2+l1+1, l2 TSRMLS_CC); + } + } + #ifdef EXIF_DEBUG +@@ -4107,7 +4120,7 @@ + if (ImageInfo.Thumbnail.size) { + if (read_thumbnail) { + /* not exif_iif_add_str : this is a buffer */ +- exif_iif_add_tag(&ImageInfo, SECTION_THUMBNAIL, "THUMBNAIL", TAG_NONE, TAG_FMT_UNDEFINED, ImageInfo.Thumbnail.size, ImageInfo.Thumbnail.data TSRMLS_CC); ++ exif_iif_add_tag(&ImageInfo, SECTION_THUMBNAIL, "THUMBNAIL", TAG_NONE, TAG_FMT_UNDEFINED, ImageInfo.Thumbnail.size, ImageInfo.Thumbnail.data, ImageInfo.Thumbnail.size TSRMLS_CC); + } + if (!ImageInfo.Thumbnail.width || !ImageInfo.Thumbnail.height) { + /* try to evaluate if thumbnail data is present */ +diff --git a/ext/pdo_pgsql/tests/bug48764.phpt b/ext/pdo_pgsql/tests/bug48764.phpt +index 83fa565..14c1f68 100644 +--- a/ext/pdo_pgsql/tests/bug48764.phpt ++++ b/ext/pdo_pgsql/tests/bug48764.phpt +@@ -12,7 +12,7 @@ + $client_version = $db->getAttribute(PDO::ATTR_CLIENT_VERSION); + $server_version = $db->getAttribute(PDO::ATTR_SERVER_VERSION); + +-if (version_compare($server_version, '7.4', '<') || version_compare($client_version, '7.4', '<')) { ++if (version_compare($server_version, '7.4', '<') || version_compare($client_version, '7.4', '<') || version_compare($server_version, '10', '>=')) { + die('skip'); + } + +--- a/ext/exif/exif.c ++++ b/ext/exif/exif.c +@@ -2901,7 +2901,7 @@ + offset_base is ImageInfo->file.list[sn].data-dir_offset + dir_entry - offset_base is dir_offset+2+i*12 + */ +- if (byte_count > IFDlength || offset_val > IFDlength-byte_count || value_ptr < dir_entry || offset_val < (size_t)(dir_entry-offset_base)) { ++ if (byte_count > IFDlength || offset_val > IFDlength-byte_count || value_ptr < dir_entry || offset_val < (size_t)(dir_entry-offset_base) || dir_entry <= offset_base) { + /* It is important to check for IMAGE_FILETYPE_TIFF + * JPEG does not use absolute pointers instead its pointers are + * relative to the start of the TIFF header in APP1 section. */ +diff --git a/win32/build/Makefile b/win32/build/Makefile +index 87a3e81..ae3cbfc 100644 +--- a/win32/build/Makefile ++++ b/win32/build/Makefile +@@ -90,7 +90,9 @@ + + $(BUILD_DIR)\$(PHPDLL): generated_files $(PHPDEF) $(PHP_GLOBAL_OBJS) $(STATIC_EXT_OBJS) $(PHPDLL_RES) $(MCFILE) + @copy win32\build\default.manifest $(BUILD_DIR)\$(PHPDLL).manifest +- @$(CC) $(PHP_GLOBAL_OBJS) $(STATIC_EXT_OBJS) $(STATIC_EXT_LIBS) $(LIBS) $(PHPDLL_RES) /link /out:$(BUILD_DIR)\$(PHPDLL) $(PHP5_PGD_OPTION) $(PHP_LDFLAGS) $(LDFLAGS) $(STATIC_EXT_LDFLAGS) ++ @$(LD) @<< ++$(PHP_GLOBAL_OBJS) $(STATIC_EXT_OBJS) $(STATIC_EXT_LIBS) $(LIBS) $(PHPDLL_RES) /out:$(BUILD_DIR)\$(PHPDLL) $(PHP5_PGD_OPTION) $(PHP_LDFLAGS) $(LDFLAGS) $(STATIC_EXT_LDFLAGS) ++<< + -@$(_VC_MANIFEST_EMBED_DLL) + + $(BUILD_DIR)\$(PHPLIB): $(BUILD_DIR)\$(PHPDLL) +diff --git a/ext/gd/libgd/xbm.c b/ext/gd/libgd/xbm.c +index 503ac82..99931a5 100644 +--- a/ext/gd/libgd/xbm.c ++++ b/ext/gd/libgd/xbm.c +@@ -135,7 +135,11 @@ + } + h[3] = ch; + } +- sscanf(h, "%x", &b); ++ if (sscanf(h, "%x", &b) != 1) { ++ php_gd_error("invalid XBM"); ++ gdImageDestroy(im); ++ return 0; ++ } + for (bit = 1; bit <= max_bit; bit = bit << 1) { + gdImageSetPixel(im, x++, y, (b & bit) ? 1 : 0); + if (x == im->sx) { +--- /dev/null ++++ b/ext/gd/tests/bug77973.phpt +@@ -0,0 +1,26 @@ ++--TEST-- ++Bug #77973 (Uninitialized read in gdImageCreateFromXbm) ++--SKIPIF-- ++<?php ++if (!extension_loaded('gd')) die("skip gd extension not available"); ++if (!function_exists('imagecreatefromxbm')) die("skip imagecreatefromxbm not available"); ++?> ++--FILE-- ++<?php ++$contents = hex2bin("23646566696e6520776964746820320a23646566696e652068656967687420320a737461746963206368617220626974735b5d203d7b0a7a7a787a7a"); ++$filepath = __DIR__ . '/bug77973.xbm'; ++file_put_contents($filepath, $contents); ++$im = imagecreatefromxbm($filepath); ++var_dump($im); ++?> ++===DONE=== ++--EXPECTF-- ++Warning: imagecreatefromxbm(): invalid XBM in %s on line %d ++ ++Warning: imagecreatefromxbm(): '%s' is not a valid XBM file in %s on line %d ++bool(false) ++===DONE=== ++--CLEAN-- ++<?php ++unlink(__DIR__ . '/bug77973.xbm'); ++?> +diff --git a/ext/iconv/iconv.c b/ext/iconv/iconv.c +index 335dbd1..bbc4b0f 100644 +--- a/ext/iconv/iconv.c ++++ b/ext/iconv/iconv.c +@@ -1645,7 +1645,9 @@ + * we can do at this point. */ + if (*(p1 + 1) == '=') { + ++p1; +- --str_left; ++ if (str_left > 1) { ++ --str_left; ++ } + } + + err = _php_iconv_appendl(pretval, encoded_word, (size_t)((p1 + 1) - encoded_word), cd_pl); +--- /dev/null ++++ b/ext/iconv/tests/bug78069.data +@@ -0,0 +1 @@ ++SuLt; 0Jpaa +\ No newline at end of file +--- /dev/null ++++ b/ext/iconv/tests/bug78069.phpt +@@ -0,0 +1,15 @@ ++--TEST-- ++Bug #78069 (Out-of-bounds read in iconv.c:_php_iconv_mime_decode() due to integer overflow) ++--SKIPIF-- ++<?php ++if (!extension_loaded('iconv')) die('skip ext/iconv required'); ++?> ++--FILE-- ++<?php ++$hdr = iconv_mime_decode_headers(file_get_contents(__DIR__ . "/bug78069.data"),2); ++var_dump(count($hdr)); ++?> ++DONE ++--EXPECT-- ++int(1) ++DONE +\ No newline at end of file +diff --git a/ext/exif/exif.c b/ext/exif/exif.c +index 15e091b..b6c3177 100644 +--- a/ext/exif/exif.c ++++ b/ext/exif/exif.c +@@ -3536,6 +3536,8 @@ + if (c == 0xFF) + return FALSE; + marker = c; ++ if (pos>=ImageInfo->Thumbnail.size) ++ return FALSE; + length = php_jpg_get16(data+pos); + if (length > ImageInfo->Thumbnail.size || pos >= ImageInfo->Thumbnail.size - length) { + return FALSE; +--- /dev/null ++++ b/ext/exif/tests/bug77988.jpg +@@ -0,0 +1 @@ ++ÿØ0 +\ No newline at end of file +--- /dev/null ++++ b/ext/exif/tests/bug77988.phpt +@@ -0,0 +1,11 @@ ++--TEST-- ++Bug #77988 (heap-buffer-overflow on php_jpg_get16) ++--SKIPIF-- ++<?php if (!extension_loaded('exif')) print 'skip exif extension not available';?> ++--FILE-- ++<?php ++exif_read_data(__DIR__."/bug77988.jpg", 'COMMENT', FALSE, TRUE); ++?> ++DONE ++--EXPECTF-- ++DONE +\ No newline at end of file +diff --git a/ext/sqlite3/sqlite3.c b/ext/sqlite3/sqlite3.c +index 761b777..7bf873f 100644 +--- a/ext/sqlite3/sqlite3.c ++++ b/ext/sqlite3/sqlite3.c +@@ -2062,6 +2062,15 @@ + } + #endif + ++ if (strncmp(arg3, "file:", 5) == 0) { ++ /* starts with "file:" */ ++ if (!arg3[5]) { ++ return SQLITE_DENY; ++ } ++ if (php_check_open_basedir(arg3 + 5 TSRMLS_CC)) { ++ return SQLITE_DENY; ++ } ++ } + if (php_check_open_basedir(arg3 TSRMLS_CC)) { + return SQLITE_DENY; + } +diff --git a/run-tests.php b/run-tests.php +index 0949d50..7dab5ab 100755 +--- a/run-tests.php ++++ b/run-tests.php +@@ -1553,6 +1553,11 @@ + $info = " (warn: $m[1])"; + } + } ++ ++ if (!strncasecmp('xfail', ltrim($output), 5)) { ++ // Pretend we have an XFAIL section ++ $section_text['XFAIL'] = trim(substr(ltrim($output), 5)); ++ } + } + } + +diff --git a/ext/phar/tests/phar_bz2.phpt b/ext/phar/tests/phar_bz2.phpt +index 0e6e3ec..106fa89 100644 +--- a/ext/phar/tests/phar_bz2.phpt ++++ b/ext/phar/tests/phar_bz2.phpt +@@ -5,6 +5,7 @@ + if (!extension_loaded("phar")) die("skip"); + if (!extension_loaded("spl")) die("skip SPL not available"); + if (!extension_loaded("bz2")) die("skip bz2 not available"); ++if (phpversion() < "7.0.0" && extension_loaded('Zend OPcache') && ini_get('opcache.enable_cli')==1) die("xfail for PHP version lower than 7 when OPcache enabled"); + ?> + --INI-- + phar.readonly=0 +diff --git a/ext/phar/tests/phar_gzip.phpt b/ext/phar/tests/phar_gzip.phpt +index c722834..19d5606 100644 +--- a/ext/phar/tests/phar_gzip.phpt ++++ b/ext/phar/tests/phar_gzip.phpt +@@ -7,6 +7,7 @@ + if (!extension_loaded("spl")) die("skip SPL not available"); + if (!extension_loaded("zlib")) die("skip zlib not available"); + if (version_compare(phpversion(), '5.2.6', '<')) die("skip zlib is buggy in PHP < 5.2.6"); ++if (phpversion() < "7.0.0" && extension_loaded('Zend OPcache') && ini_get('opcache.enable_cli')==1) die("xfail for PHP version lower than 7 when OPcache enabled"); + ?> + --INI-- + phar.readonly=0 +diff --git a/ext/phar/tests/tar/rename.phpt b/ext/phar/tests/tar/rename.phpt +index 96588a6..9b2b4f4 100644 +--- a/ext/phar/tests/tar/rename.phpt ++++ b/ext/phar/tests/tar/rename.phpt +@@ -1,7 +1,10 @@ + --TEST-- + Phar: rename test tar-based + --SKIPIF-- +-<?php if (!extension_loaded("phar")) die("skip"); ?> ++<?php ++if (!extension_loaded("phar")) die("skip"); ++if (phpversion() < "7.0.0" && extension_loaded('Zend OPcache') && ini_get('opcache.enable_cli')==1) die("xfail for PHP version lower than 7 when OPcache enabled"); ++?> + --INI-- + phar.readonly=0 + phar.require_hash=0 +diff --git a/ext/phar/tests/tar/rename_dir.phpt b/ext/phar/tests/tar/rename_dir.phpt +index 0b95789..4ca8ceb 100644 +--- a/ext/phar/tests/tar/rename_dir.phpt ++++ b/ext/phar/tests/tar/rename_dir.phpt +@@ -1,7 +1,10 @@ + --TEST-- + Phar: rename_dir test tar-based + --SKIPIF-- +-<?php if (!extension_loaded("phar")) die("skip"); ?> ++<?php ++if (!extension_loaded("phar")) die("skip"); ++if (phpversion() < "7.0.0" && extension_loaded('Zend OPcache') && ini_get('opcache.enable_cli')==1) die("xfail for PHP version lower than 7 when OPcache enabled"); ++?> + --INI-- + phar.readonly=0 + phar.require_hash=0 +diff --git a/ext/phar/tests/tar/rmdir.phpt b/ext/phar/tests/tar/rmdir.phpt +index be03782..6cb5eab 100644 +--- a/ext/phar/tests/tar/rmdir.phpt ++++ b/ext/phar/tests/tar/rmdir.phpt +@@ -1,7 +1,10 @@ + --TEST-- + Phar: rmdir test tar-based + --SKIPIF-- +-<?php if (!extension_loaded("phar")) die("skip"); ?> ++<?php ++if (!extension_loaded("phar")) die("skip"); ++if (phpversion() < "7.0.0" && extension_loaded('Zend OPcache') && ini_get('opcache.enable_cli')==1) die("xfail for PHP version lower than 7 when OPcache enabled"); ++?> + --INI-- + phar.readonly=0 + phar.require_hash=0 +diff --git a/ext/phar/tests/tar/tar_gzip.phpt b/ext/phar/tests/tar/tar_gzip.phpt +index d44e1b1..a13a80a 100644 +--- a/ext/phar/tests/tar/tar_gzip.phpt ++++ b/ext/phar/tests/tar/tar_gzip.phpt +@@ -7,6 +7,7 @@ + if (!extension_loaded("spl")) die("skip SPL not available"); + if (!extension_loaded("zlib")) die("skip zlib not available"); + if (version_compare(phpversion(), '5.2.6', '<')) die("skip zlib is buggy in PHP < 5.2.6"); ++if (phpversion() < "7.0.0" && extension_loaded('Zend OPcache') && ini_get('opcache.enable_cli')==1) die("xfail for PHP version lower than 7 when OPcache enabled"); + ?> + --INI-- + phar.readonly=0 +diff --git a/ext/phar/tests/zip/rename.phpt b/ext/phar/tests/zip/rename.phpt +index 9b1f5c9..776bcae 100644 +--- a/ext/phar/tests/zip/rename.phpt ++++ b/ext/phar/tests/zip/rename.phpt +@@ -1,7 +1,10 @@ + --TEST-- + Phar: rename test zip-based + --SKIPIF-- +-<?php if (!extension_loaded("phar")) die("skip"); ?> ++<?php ++if (!extension_loaded("phar")) die("skip"); ++if (phpversion() < "7.0.0" && extension_loaded('Zend OPcache') && ini_get('opcache.enable_cli')==1) die("xfail for PHP version lower than 7 when OPcache enabled"); ++?> + --INI-- + phar.readonly=0 + phar.require_hash=0 +diff --git a/ext/phar/tests/zip/rename_dir.phpt b/ext/phar/tests/zip/rename_dir.phpt +index bb03c7f..3452f8f 100644 +--- a/ext/phar/tests/zip/rename_dir.phpt ++++ b/ext/phar/tests/zip/rename_dir.phpt +@@ -1,7 +1,10 @@ + --TEST-- + Phar: rename_dir test zip-based + --SKIPIF-- +-<?php if (!extension_loaded("phar")) die("skip"); ?> ++<?php ++if (!extension_loaded("phar")) die("skip"); ++if (phpversion() < "7.0.0" && extension_loaded('Zend OPcache') && ini_get('opcache.enable_cli')==1) die("xfail for PHP version lower than 7 when OPcache enabled"); ++?> + --INI-- + phar.readonly=0 + phar.require_hash=0 +diff --git a/ext/phar/tests/zip/rmdir.phpt b/ext/phar/tests/zip/rmdir.phpt +index c7ef9da..7d062d5 100644 +--- a/ext/phar/tests/zip/rmdir.phpt ++++ b/ext/phar/tests/zip/rmdir.phpt +@@ -1,7 +1,10 @@ + --TEST-- + Phar: rmdir test zip-based + --SKIPIF-- +-<?php if (!extension_loaded("phar")) die("skip"); ?> ++<?php ++if (!extension_loaded("phar")) die("skip"); ++if (phpversion() < "7.0.0" && extension_loaded('Zend OPcache') && ini_get('opcache.enable_cli')==1) die("xfail for PHP version lower than 7 when OPcache enabled"); ++?> + --INI-- + phar.readonly=0 + phar.require_hash=0 +diff --git a/ext/exif/exif.c b/ext/exif/exif.c +index b6c3177..a5fa0b8 100644 +--- a/ext/exif/exif.c ++++ b/ext/exif/exif.c +@@ -3508,7 +3508,7 @@ + size_t length=2, pos=0; + jpeg_sof_info sof_info; + +- if (!data) { ++ if (!data || ImageInfo->Thumbnail.size < 4) { + return FALSE; /* nothing to do here */ + } + if (memcmp(data, "\xFF\xD8\xFF", 3)) { +--- /dev/null ++++ b/ext/exif/tests/bug78222.jpg +@@ -0,0 +1 @@ ++ÿØá +\ No newline at end of file +--- /dev/null ++++ b/ext/exif/tests/bug78222.phpt +@@ -0,0 +1,11 @@ ++--TEST-- ++Bug #78222 (heap-buffer-overflow on exif_scan_thumbnail) ++--SKIPIF-- ++<?php if (!extension_loaded('exif')) print 'skip exif extension not available';?> ++--FILE-- ++<?php ++exif_read_data(__DIR__."/bug78222.jpg", 'THUMBNAIL', FALSE, TRUE); ++?> ++DONE ++--EXPECTF-- ++DONE +\ No newline at end of file +diff --git a/ext/exif/exif.c b/ext/exif/exif.c +index a5fa0b8..ec362f7 100644 +--- a/ext/exif/exif.c ++++ b/ext/exif/exif.c +@@ -2628,7 +2628,7 @@ + { + int a; + char *decode; +- size_t len;; ++ size_t len; + + *pszEncoding = NULL; + /* Copy the comment */ +@@ -2641,11 +2641,11 @@ + /* First try to detect BOM: ZERO WIDTH NOBREAK SPACE (FEFF 16) + * since we have no encoding support for the BOM yet we skip that. + */ +- if (!memcmp(szValuePtr, "\xFE\xFF", 2)) { ++ if (ByteCount >=2 && !memcmp(szValuePtr, "\xFE\xFF", 2)) { + decode = "UCS-2BE"; + szValuePtr = szValuePtr+2; + ByteCount -= 2; +- } else if (!memcmp(szValuePtr, "\xFF\xFE", 2)) { ++ } else if (ByteCount >=2 && !memcmp(szValuePtr, "\xFF\xFE", 2)) { + decode = "UCS-2LE"; + szValuePtr = szValuePtr+2; + ByteCount -= 2; +--- /dev/null ++++ b/ext/exif/tests/bug78256.jpg +@@ -0,0 +1 @@ ++ÿØá +\ No newline at end of file +--- /dev/null ++++ b/ext/exif/tests/bug78256.phpt +@@ -0,0 +1,11 @@ ++--TEST-- ++Bug #78256 (heap-buffer-overflow on exif_process_user_comment) ++--SKIPIF-- ++<?php if (!extension_loaded('exif')) print 'skip exif extension not available';?> ++--FILE-- ++<?php ++@exif_read_data(__DIR__."/bug78256.jpg", 'COMMENT', FALSE, TRUE); ++?> ++DONE ++--EXPECTF-- ++DONE +\ No newline at end of file +diff --git a/ext/pcre/pcrelib/pcre_compile.c b/ext/pcre/pcrelib/pcre_compile.c +index c9171cb..1d37671 100644 +--- a/ext/pcre/pcrelib/pcre_compile.c ++++ b/ext/pcre/pcrelib/pcre_compile.c +@@ -485,7 +485,7 @@ + "lookbehind assertion is not fixed length\0" + "malformed number or name after (?(\0" + "conditional group contains more than two branches\0" +- "assertion expected after (?(\0" ++ "assertion expected after (?( or (?(?C)\0" + "(?R or (?[+-]digits must be followed by )\0" + /* 30 */ + "unknown POSIX class name\0" +@@ -6734,6 +6734,15 @@ + for (i = 3;; i++) if (!IS_DIGIT(ptr[i])) break; + if (ptr[i] == CHAR_RIGHT_PARENTHESIS) + tempptr += i + 1; ++ ++ /* tempptr should now be pointing to the opening parenthesis of the ++ assertion condition. */ ++ ++ if (*tempptr != CHAR_LEFT_PARENTHESIS) ++ { ++ *errorcodeptr = ERR28; ++ goto FAILED; ++ } + } + + /* For conditions that are assertions, check the syntax, and then exit +--- /dev/null ++++ b/ext/pcre/tests/bug75457.phpt +@@ -0,0 +1,10 @@ ++--TEST-- ++Bug #75457 (heap-use-after-free in php7.0.25) ++--FILE-- ++<?php ++$pattern = "/(((?(?C)0?=))(?!()0|.(?0)0)())/"; ++var_dump(preg_match($pattern, "hello")); ++?> ++--EXPECTF-- ++Warning: preg_match(): Compilation failed: assertion expected after (?( or (?(?C) at offset 4 in %sbug75457.php on line %d ++bool(false) +diff --git a/ext/mbstring/oniguruma/regext.c b/ext/mbstring/oniguruma/regext.c +index b1b957b..b108e63 100644 +--- a/ext/mbstring/oniguruma/regext.c ++++ b/ext/mbstring/oniguruma/regext.c +@@ -29,6 +29,7 @@ + + #include "regint.h" + ++#if 0 + static void + conv_ext0be32(const UChar* s, const UChar* end, UChar* conv) + { +@@ -158,6 +159,7 @@ + + return ONIGERR_NOT_SUPPORTED_ENCODING_COMBINATION; + } ++#endif + + extern int + onig_new_deluxe(regex_t** reg, const UChar* pattern, const UChar* pattern_end, +@@ -169,9 +171,7 @@ + if (IS_NOT_NULL(einfo)) einfo->par = (UChar* )NULL; + + if (ci->pattern_enc != ci->target_enc) { +- r = conv_encoding(ci->pattern_enc, ci->target_enc, pattern, pattern_end, +- &cpat, &cpat_end); +- if (r) return r; ++ return ONIGERR_NOT_SUPPORTED_ENCODING_COMBINATION; + } + else { + cpat = (UChar* )pattern; +diff --git a/ext/pdo_mysql/tests/pdo_mysql_exec.phpt b/ext/pdo_mysql/tests/pdo_mysql_exec.phpt +index acd9090..9830737 100644 +--- a/ext/pdo_mysql/tests/pdo_mysql_exec.phpt ++++ b/ext/pdo_mysql/tests/pdo_mysql_exec.phpt +@@ -75,7 +75,7 @@ + exec_and_count(19, $db, 'CREATE PROCEDURE p(OUT ver_param VARCHAR(255)) BEGIN SELECT VERSION() INTO ver_param; END;', 0); + // we got this far without problems. If there's an issue from now on, its a failure + $ignore_exception = false; +- exec_and_count(20, $db, 'CALL p(@version)', 0); ++ exec_and_count(20, $db, 'CALL p(@version)', 1); + $stmt = $db->query('SELECT @version AS p_version'); + $tmp = $stmt->fetchAll(PDO::FETCH_ASSOC); + if (count($tmp) > 1 || !isset($tmp[0]['p_version'])) { +diff --git a/ext/pdo_mysql/tests/pdo_mysql_stmt_getcolumnmeta.phpt b/ext/pdo_mysql/tests/pdo_mysql_stmt_getcolumnmeta.phpt +index d2097f1..a217127 100644 +--- a/ext/pdo_mysql/tests/pdo_mysql_stmt_getcolumnmeta.phpt ++++ b/ext/pdo_mysql/tests/pdo_mysql_stmt_getcolumnmeta.phpt +@@ -162,37 +162,37 @@ + test_meta($db, 100, 'INT', -2147483648, 'LONG', ($is_mysqlnd) ? PDO::PARAM_INT : PDO::PARAM_STR); + test_meta($db, 110, 'INT UNSIGNED', 4294967295, 'LONG', ($is_mysqlnd) ? PDO::PARAM_INT : PDO::PARAM_STR); + +- test_meta($db, 120, 'BIGINT', -9223372036854775808, 'LONGLONG', ($is_mysqlnd) ? ((PHP_INT_SIZE == 4) ? PDO::PARAM_STR : PDO::PARAM_INT) : PDO::PARAM_STR); +- test_meta($db, 130, 'BIGINT UNSIGNED', 18446744073709551615, 'LONGLONG', ($is_mysqlnd) ? ((PHP_INT_SIZE == 4) ? PDO::PARAM_STR : PDO::PARAM_INT) : PDO::PARAM_STR); ++ test_meta($db, 120, 'BIGINT', '-9223372036854775808', 'LONGLONG', ($is_mysqlnd) ? ((PHP_INT_SIZE == 4) ? PDO::PARAM_STR : PDO::PARAM_INT) : PDO::PARAM_STR); ++ test_meta($db, 130, 'BIGINT UNSIGNED', '18446744073709551615', 'LONGLONG', ($is_mysqlnd) ? ((PHP_INT_SIZE == 4) ? PDO::PARAM_STR : PDO::PARAM_INT) : PDO::PARAM_STR); + + test_meta($db, 130, 'REAL', -1.01, ($real_as_float) ? 'FLOAT' : 'DOUBLE', PDO::PARAM_STR); + test_meta($db, 140, 'REAL UNSIGNED', 1.01, ($real_as_float) ? 'FLOAT' : 'DOUBLE', PDO::PARAM_STR); +- test_meta($db, 150, 'REAL ZEROFILL', -1.01, ($real_as_float) ? 'FLOAT' : 'DOUBLE', PDO::PARAM_STR); ++ test_meta($db, 150, 'REAL ZEROFILL', 1.01, ($real_as_float) ? 'FLOAT' : 'DOUBLE', PDO::PARAM_STR); + test_meta($db, 160, 'REAL UNSIGNED ZEROFILL', 1.01, ($real_as_float) ? 'FLOAT' : 'DOUBLE', PDO::PARAM_STR); + + test_meta($db, 170, 'DOUBLE', -1.01, 'DOUBLE', PDO::PARAM_STR); + test_meta($db, 180, 'DOUBLE UNSIGNED', 1.01, 'DOUBLE', PDO::PARAM_STR); +- test_meta($db, 190, 'DOUBLE ZEROFILL', -1.01, 'DOUBLE', PDO::PARAM_STR); ++ test_meta($db, 190, 'DOUBLE ZEROFILL', 1.01, 'DOUBLE', PDO::PARAM_STR); + test_meta($db, 200, 'DOUBLE UNSIGNED ZEROFILL', 1.01, 'DOUBLE', PDO::PARAM_STR); + + test_meta($db, 210, 'FLOAT', -1.01, 'FLOAT', PDO::PARAM_STR); + test_meta($db, 220, 'FLOAT UNSIGNED', 1.01, 'FLOAT', PDO::PARAM_STR); +- test_meta($db, 230, 'FLOAT ZEROFILL', -1.01, 'FLOAT', PDO::PARAM_STR); ++ test_meta($db, 230, 'FLOAT ZEROFILL', 1.01, 'FLOAT', PDO::PARAM_STR); + test_meta($db, 240, 'FLOAT UNSIGNED ZEROFILL', 1.01, 'FLOAT', PDO::PARAM_STR); + + test_meta($db, 250, 'DECIMAL', -1.01, array('DECIMAL', 'NEWDECIMAL'), PDO::PARAM_STR); + test_meta($db, 260, 'DECIMAL UNSIGNED', 1.01, array('DECIMAL', 'NEWDECIMAL'), PDO::PARAM_STR); +- test_meta($db, 270, 'DECIMAL ZEROFILL', -1.01, array('DECIMAL', 'NEWDECIMAL'), PDO::PARAM_STR); ++ test_meta($db, 270, 'DECIMAL ZEROFILL', 1.01, array('DECIMAL', 'NEWDECIMAL'), PDO::PARAM_STR); + test_meta($db, 280, 'DECIMAL UNSIGNED ZEROFILL', 1.01, array('DECIMAL', 'NEWDECIMAL'), PDO::PARAM_STR); + + test_meta($db, 290, 'NUMERIC', -1.01, array('DECIMAL', 'NEWDECIMAL'), PDO::PARAM_STR); + test_meta($db, 300, 'NUMERIC UNSIGNED', 1.01, array('DECIMAL', 'NEWDECIMAL'), PDO::PARAM_STR); +- test_meta($db, 310, 'NUMERIC ZEROFILL', -1.01, array('DECIMAL', 'NEWDECIMAL'), PDO::PARAM_STR); ++ test_meta($db, 310, 'NUMERIC ZEROFILL', 1.01, array('DECIMAL', 'NEWDECIMAL'), PDO::PARAM_STR); + test_meta($db, 320, 'NUMERIC UNSIGNED ZEROFILL', 1.01, array('DECIMAL', 'NEWDECIMAL'), PDO::PARAM_STR); + + test_meta($db, 330, 'DATE', '2008-04-23', array('DATE', 'NEWDATE'), PDO::PARAM_STR); + test_meta($db, 340, 'TIME', '14:37:00', 'TIME', PDO::PARAM_STR); +- test_meta($db, 350, 'TIMESTAMP', time(), 'TIMESTAMP', PDO::PARAM_STR); ++ test_meta($db, 350, 'TIMESTAMP', '2008-03-23 14:38:00', 'TIMESTAMP', PDO::PARAM_STR); + test_meta($db, 360, 'DATETIME', '2008-03-23 14:38:00', 'DATETIME', PDO::PARAM_STR); + test_meta($db, 370, 'YEAR', '2008', 'YEAR', ($is_mysqlnd) ? PDO::PARAM_INT : PDO::PARAM_STR); + +diff --git a/ext/opcache/tests/bug66461.phpt b/ext/opcache/tests/bug66461.phpt +index 33132ab..2d09fef 100644 +--- a/ext/opcache/tests/bug66461.phpt ++++ b/ext/opcache/tests/bug66461.phpt +@@ -4,6 +4,7 @@ + opcache.enable=1 + opcache.enable_cli=1 + opcache.optimization_level=-1 ++opcache.log_verbosity_level=1 + opcache.file_update_protection=0 + opcache.interned_strings_buffer=0 + --SKIPIF-- +diff --git a/sapi/fpm/fpm/fpm_main.c b/sapi/fpm/fpm/fpm_main.c +index 0848fd8..c4bb370 100644 +--- a/sapi/fpm/fpm/fpm_main.c ++++ b/sapi/fpm/fpm/fpm_main.c +@@ -1245,8 +1245,8 @@ + path_info = script_path_translated + ptlen; + tflag = (slen != 0 && (!orig_path_info || strcmp(orig_path_info, path_info) != 0)); + } else { +- path_info = env_path_info ? env_path_info + pilen - slen : NULL; +- tflag = (orig_path_info != path_info); ++ path_info = (env_path_info && pilen > slen) ? env_path_info + pilen - slen : NULL; ++ tflag = path_info && (orig_path_info != path_info); + } + + if (tflag) { +diff --git a/ext/bcmath/libbcmath/src/str2num.c b/ext/bcmath/libbcmath/src/str2num.c +index c484c15..a5e7850 100644 +--- a/ext/bcmath/libbcmath/src/str2num.c ++++ b/ext/bcmath/libbcmath/src/str2num.c +@@ -57,9 +57,9 @@ + zero_int = FALSE; + if ( (*ptr == '+') || (*ptr == '-')) ptr++; /* Sign */ + while (*ptr == '0') ptr++; /* Skip leading zeros. */ +- while (isdigit((int)*ptr)) ptr++, digits++; /* digits */ ++ while (*ptr >= '0' && *ptr <= '9') ptr++, digits++; /* digits */ + if (*ptr == '.') ptr++; /* decimal point */ +- while (isdigit((int)*ptr)) ptr++, strscale++; /* digits */ ++ while (*ptr >= '0' && *ptr <= '9') ptr++, strscale++; /* digits */ + if ((*ptr != '\0') || (digits+strscale == 0)) + { + *num = bc_copy_num (BCG(_zero_)); +--- /dev/null ++++ b/ext/bcmath/tests/bug78878.phpt +@@ -0,0 +1,13 @@ ++--TEST-- ++Bug #78878 (Buffer underflow in bc_shift_addsub) ++--SKIPIF-- ++<?php ++if (!extension_loaded('bcmath')) die('skip bcmath extension not available'); ++?> ++--FILE-- ++<?php ++print @bcmul("\xB26483605105519922841849335928742092", bcpowmod(2, 65535, -4e-4)); ++?> ++--EXPECT-- ++bc math warning: non-zero scale in modulus ++0 +diff --git a/ext/standard/link_win32.c b/ext/standard/link_win32.c +index 059201c..4c537db 100644 +--- a/ext/standard/link_win32.c ++++ b/ext/standard/link_win32.c +@@ -208,7 +208,7 @@ + + /*First argument to link function is the target and hence should go to frompath + Second argument to link function is the link itself and hence should go to topath */ +- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss", &frompath, &frompath_len, &topath, &topath_len) == FAILURE) { ++ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "pp", &frompath, &frompath_len, &topath, &topath_len) == FAILURE) { + return; + } + +--- /dev/null ++++ b/ext/standard/tests/file/windows_links/bug78862.phpt +@@ -0,0 +1,17 @@ ++--TEST-- ++Bug #78862 (link() silently truncates after a null byte on Windows) ++--FILE-- ++<?php ++file_put_contents(__DIR__ . '/bug78862.target', 'foo'); ++var_dump(link(__DIR__ . "/bug78862.target\0more", __DIR__ . "/bug78862.link\0more")); ++var_dump(file_exists(__DIR__ . '/bug78862.link')); ++?> ++--EXPECTF-- ++Warning: link() expects parameter 1 to be a valid path, string given in %s on line %d ++NULL ++bool(false) ++--CLEAN-- ++<?php ++unlink(__DIR__ . '/bug78862.target'); ++unlink(__DIR__ . '/bug78862.link'); ++?> +diff --git a/ext/spl/spl_directory.c b/ext/spl/spl_directory.c +index fbcf892..3a22357 100644 +--- a/ext/spl/spl_directory.c ++++ b/ext/spl/spl_directory.c +@@ -691,10 +691,10 @@ + + if (SPL_HAS_FLAG(ctor_flags, DIT_CTOR_FLAGS)) { + flags = SPL_FILE_DIR_KEY_AS_PATHNAME|SPL_FILE_DIR_CURRENT_AS_FILEINFO; +- parsed = zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &path, &len, &flags); ++ parsed = zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p|l", &path, &len, &flags); + } else { + flags = SPL_FILE_DIR_KEY_AS_PATHNAME|SPL_FILE_DIR_CURRENT_AS_SELF; +- parsed = zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &path, &len); ++ parsed = zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p", &path, &len); + } + if (SPL_HAS_FLAG(ctor_flags, SPL_FILE_DIR_SKIPDOTS)) { + flags |= SPL_FILE_DIR_SKIPDOTS; +--- /dev/null ++++ b/ext/spl/tests/bug78863.phpt +@@ -0,0 +1,31 @@ ++--TEST-- ++Bug #78863 (DirectoryIterator class silently truncates after a null byte) ++--FILE-- ++<?php ++$dir = __DIR__ . '/bug78863'; ++mkdir($dir); ++touch("$dir/bad"); ++mkdir("$dir/sub"); ++touch("$dir/sub/good"); ++ ++$it = new DirectoryIterator(__DIR__ . "/bug78863\0/sub"); ++foreach ($it as $fileinfo) { ++ if (!$fileinfo->isDot()) { ++ var_dump($fileinfo->getFilename()); ++ } ++} ++?> ++--EXPECTF-- ++Fatal error: Uncaught UnexpectedValueException: DirectoryIterator::__construct() expects parameter 1 to be a valid path, string given in %s:%d ++Stack trace: ++#0 %s(%d): DirectoryIterator->__construct('%s') ++#1 {main} ++ thrown in %s on line %d ++--CLEAN-- ++<?php ++$dir = __DIR__ . '/bug78863'; ++unlink("$dir/sub/good"); ++rmdir("$dir/sub"); ++unlink("$dir/bad"); ++rmdir($dir); ++?> +diff --git a/ext/exif/exif.c b/ext/exif/exif.c +index ec362f7..6a3bb91 100644 +--- a/ext/exif/exif.c ++++ b/ext/exif/exif.c +@@ -2831,8 +2831,9 @@ + } + + for (de=0;de<NumDirEntries;de++) { +- if (!exif_process_IFD_TAG(ImageInfo, dir_start + 2 + 12 * de, +- offset_base, data_len, displacement, section_index, 0, maker_note->tag_table TSRMLS_CC)) { ++ size_t offset = 2 + 12 * de; ++ if (!exif_process_IFD_TAG(ImageInfo, dir_start + offset, ++ offset_base, data_len - offset, displacement, section_index, 0, maker_note->tag_table TSRMLS_CC)) { + return FALSE; + } + } +diff --git a/ext/exif/exif.c b/ext/exif/exif.c +index 6a3bb91..f64a14e 100644 +--- a/ext/exif/exif.c ++++ b/ext/exif/exif.c +@@ -2759,7 +2759,8 @@ + continue; + if (maker_note->model && (!ImageInfo->model || strcmp(maker_note->model, ImageInfo->model))) + continue; +- if (maker_note->id_string && strncmp(maker_note->id_string, value_ptr, maker_note->id_string_len)) ++ if (maker_note->id_string && value_len >= maker_note->id_string_len ++ && strncmp(maker_note->id_string, value_ptr, maker_note->id_string_len)) + continue; + break; + } +--- /dev/null ++++ b/ext/exif/tests/bug78910.phpt +@@ -0,0 +1,17 @@ ++--TEST-- ++Bug #78910: Heap-buffer-overflow READ in exif (OSS-Fuzz #19044) ++--FILE-- ++<?php ++ ++var_dump(exif_read_data('data:image/jpg;base64,TU0AKgAAAAwgICAgAAIBDwAEAAAAAgAAACKSfCAgAAAAAEZVSklGSUxN')); ++ ++?> ++--EXPECTF-- ++Notice: exif_read_data(): Read from TIFF: tag(0x927C, MakerNote ): Illegal format code 0x2020, switching to BYTE in %s on line %d ++ ++Warning: exif_read_data(): Process tag(x927C=MakerNote ): Illegal format code 0x2020, suppose BYTE in %s on line %d ++ ++Warning: exif_read_data(): IFD data too short: 0x0000 offset 0x000C in %s on line %d ++ ++Warning: exif_read_data(): Invalid TIFF file in %s on line %d ++bool(false) +diff --git a/ext/curl/tests/curl_basic_009.phpt b/ext/curl/tests/curl_basic_009.phpt +index 529e590..3b36a78 100644 +--- a/ext/curl/tests/curl_basic_009.phpt ++++ b/ext/curl/tests/curl_basic_009.phpt +@@ -18,6 +18,6 @@ + + + ?> +---EXPECTF-- +-%unicode|string%(%d) "%Srotocol%s" +-int(1) ++--EXPECTREGEX-- ++string\(\d+\) "([^\r\n]*rotocol[^\r\n]+|Could not resolve host: .+)" ++int\(\d\) +diff --git a/ext/mysql/tests/mysql_connect.phpt b/ext/mysql/tests/mysql_connect.phpt +index 2b73092..be40c34 100644 +--- a/ext/mysql/tests/mysql_connect.phpt ++++ b/ext/mysql/tests/mysql_connect.phpt +@@ -1,5 +1,7 @@ + --TEST-- + mysql_connect() ++--INI-- ++error_reporting=E_ALL&~E_DEPRECATED + --SKIPIF-- + <?php + require_once('skipif.inc'); +@@ -104,25 +106,5 @@ + print "done!"; + ?> + --EXPECTF-- +-Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in %s on line %d +- +-Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in %s on line %d +- +-Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in %s on line %d +- + Warning: mysql_connect(): Access denied for user '%s'@'%s' (using password: YES) in %s on line %d +- +-Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in %s on line %d +- +-Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in %s on line %d +- +-Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in %s on line %d +- +-Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in %s on line %d +- +-Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in %s on line %d +- +-Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in %s on line %d +- +-Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in %s on line %d + done! +diff --git a/ext/mysql/tests/mysql_query_load_data_openbasedir.phpt b/ext/mysql/tests/mysql_query_load_data_openbasedir.phpt +index c2cb41e..b3f0c31 100644 +--- a/ext/mysql/tests/mysql_query_load_data_openbasedir.phpt ++++ b/ext/mysql/tests/mysql_query_load_data_openbasedir.phpt +@@ -2,6 +2,8 @@ + LOAD DATA INFILE - open_basedir + --SKIPIF-- + <?php ++if (substr(PHP_OS, 0, 3) == 'WIN') die("skip this test is not for Windows platforms"); ++ + include_once('skipif.inc'); + include_once('skipifconnectfailure.inc'); + +--- /dev/null ++++ b/sapi/cgi/tests/bug69487.phpt +@@ -0,0 +1,20 @@ ++--TEST-- ++Bug #69487 (SAPI may truncate POST data) ++--INI-- ++allow_url_fopen=1 ++sys_temp_dir=/not-supposed-to-exist ++--POST-- ++foo=bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar ++--FILE-- ++<?php ++var_dump(isset($_POST['foo'])); ++var_dump(strlen(file_get_contents('php://input'))); ++?> ++--EXPECT-- ++Warning: Unknown: Unable to create temporary file, Check permissions in temporary files directory. in Unknown on line 0 ++ ++Warning: Unknown: POST data can't be buffered; all data discarded in Unknown on line 0 ++ ++Warning: Cannot modify header information - headers already sent in Unknown on line 0 ++bool(false) ++int(0) +diff --git a/sapi/tests/bug69487.phpt b/sapi/tests/bug69487.phpt +deleted file mode 100644 +index 3ac3796..0000000 +--- a/sapi/tests/bug69487.phpt ++++ /dev/null +@@ -1,20 +0,0 @@ +---TEST-- +-Bug #69487 (SAPI may truncate POST data) +---INI-- +-allow_url_fopen=1 +-sys_temp_dir=/not-supposed-to-exist +---POST-- +-foo=bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar-bar +---FILE-- +-<?php +-var_dump(isset($_POST['foo'])); +-var_dump(strlen(file_get_contents('php://input'))); +-?> +---EXPECT-- +-Warning: Unknown: Unable to create temporary file, Check permissions in temporary files directory. in Unknown on line 0 +- +-Warning: Unknown: POST data can't be buffered; all data discarded in Unknown on line 0 +- +-Warning: Cannot modify header information - headers already sent in Unknown on line 0 +-bool(false) +-int(0) +diff --git a/sapi/tests/test001.phpt b/sapi/tests/test001.phpt +deleted file mode 100644 +index a964393..0000000 +--- a/sapi/tests/test001.phpt ++++ /dev/null +@@ -1,16 +0,0 @@ +---TEST-- +-IIS style CGI missing SCRIPT_FILENAME +---DESCRIPTION-- +-This would be similar to what IIS produces for a simple query. +---ENV-- +-return <<<END +-PATH_TRANSLATED=$filename +-PATH_INFO=$scriptname +-SCRIPT_NAME=$scriptname +-END; +---FILE-- +-<?php +- echo "HELLO"; +-?> +---EXPECT-- +-HELLO +\ No newline at end of file +diff --git a/sapi/tests/test002.phpt b/sapi/tests/test002.phpt +deleted file mode 100644 +index 42ade3d..0000000 +--- a/sapi/tests/test002.phpt ++++ /dev/null +@@ -1,22 +0,0 @@ +---TEST-- +-Apache style CGI +---DESCRIPTION-- +-Apache likes to set SCRIPT_FILENAME to the php executable +-if you use ScriptAlias configurations, and the proper +-path is in PATH_TRANSLATED. SCRIPT_NAME in this is faked, +-but that is ok, Apache sets SCRIPT_NAME to the ScriptAlias +-of the executable. +---ENV-- +-return <<<END +-REDIRECT_URL=$scriptname +-PATH_TRANSLATED=$filename +-PATH_INFO=$scriptname +-SCRIPT_NAME=/scriptalias/php +-SCRIPT_FILENAME=$this->conf['TEST_PHP_EXECUTABLE'] +-END; +---FILE-- +-<?php +- echo "HELLO"; +-?> +---EXPECT-- +-HELLO +\ No newline at end of file +diff --git a/sapi/tests/test003.phpt b/sapi/tests/test003.phpt +deleted file mode 100644 +index 5cabe66..0000000 +--- a/sapi/tests/test003.phpt ++++ /dev/null +@@ -1,21 +0,0 @@ +---TEST-- +-IIS style CGI missing SCRIPT_FILENAME, has PATH_INFO +---DESCRIPTION-- +-This would be similar to what IIS produces for a simple query +-that also has PATH_INFO. +---REQUEST-- +-return <<<END +-PATH_INFO=/path/info +-END; +---ENV-- +-return <<<END +-PATH_TRANSLATED=/path/bla +-PATH_INFO=/path/info +-SCRIPT_NAME=path +-END; +---FILE-- +-<?php +- echo $_SERVER['PATH_INFO']; +-?> +---EXPECT-- +-/path/info +\ No newline at end of file +diff --git a/sapi/tests/test004.phpt b/sapi/tests/test004.phpt +deleted file mode 100644 +index ef43774..0000000 +--- a/sapi/tests/test004.phpt ++++ /dev/null +@@ -1,26 +0,0 @@ +---TEST-- +-Apache style CGI with PATH_INFO +---DESCRIPTION-- +-Apache likes to set SCRIPT_FILENAME to the php executable +-if you use ScriptAlias configurations, and the proper +-path is in PATH_TRANSLATED. SCRIPT_NAME in this is faked, +-but that is ok, Apache sets SCRIPT_NAME to the ScriptAlias +-of the executable. +---REQUEST-- +-return <<<END +-PATH_INFO=/path/info +-END; +---ENV-- +-return <<<END +-REDIRECT_URL=/path +-PATH_TRANSLATED=/path/info/fpp +-PATH_INFO=/path/info +-SCRIPT_NAME=/scriptalias/php +-SCRIPT_FILENAME=$this->conf['TEST_PHP_EXECUTABLE'] +-END; +---FILE-- +-<?php +- echo $_SERVER['PATH_INFO']; +-?> +---EXPECT-- +-/path/info +\ No newline at end of file +diff --git a/sapi/tests/test005.phpt b/sapi/tests/test005.phpt +deleted file mode 100644 +index 7415b66..0000000 +--- a/sapi/tests/test005.phpt ++++ /dev/null +@@ -1,27 +0,0 @@ +---TEST-- +-QUERY_STRING Security Bug +---DESCRIPTION-- +-This bug was present in PHP 4.3.0 only. +-A failure should print HELLO. +---REQUEST-- +-return <<<END +-SCRIPT_NAME=/nothing.php +-QUERY_STRING=$filename +-END; +---ENV-- +-return <<<END +-REDIRECT_URL=$scriptname +-PATH_TRANSLATED=c:\apache\1.3.27\htdocs\nothing.php +-QUERY_STRING=$filename +-PATH_INFO=/nothing.php +-SCRIPT_NAME=/phpexe/php.exe/nothing.php +-SCRIPT_FILENAME=c:\apache\1.3.27\htdocs\nothing.php +-END; +---FILE-- +-<?php +- echo "HELLO"; +-?> +---EXPECTHEADERS-- +-Status: 404 +---EXPECT-- +-No input file specified. +\ No newline at end of file +diff --git a/sapi/tests/test006.phpt b/sapi/tests/test006.phpt +deleted file mode 100644 +index 45e3781..0000000 +--- a/sapi/tests/test006.phpt ++++ /dev/null +@@ -1,73 +0,0 @@ +---TEST-- +-Multipart Form POST Data +---HEADERS-- +-return <<<END +-Content-Type=multipart/form-data; boundary=---------------------------240723202011929 +-Content-Length=862 +-END; +---ENV-- +-return <<<END +-CONTENT_TYPE=multipart/form-data; boundary=---------------------------240723202011929 +-CONTENT_LENGTH=862 +-END; +---POST-- +------------------------------240723202011929 +-Content-Disposition: form-data; name="entry" +- +-entry box +------------------------------240723202011929 +-Content-Disposition: form-data; name="password" +- +-password box +------------------------------240723202011929 +-Content-Disposition: form-data; name="radio1" +- +-test 1 +------------------------------240723202011929 +-Content-Disposition: form-data; name="checkbox1" +- +-test 1 +------------------------------240723202011929 +-Content-Disposition: form-data; name="choices" +- +-Choice 1 +------------------------------240723202011929 +-Content-Disposition: form-data; name="choices" +- +-Choice 2 +------------------------------240723202011929 +-Content-Disposition: form-data; name="file"; filename="info.php" +-Content-Type: application/octet-stream +- +-<?php +-phpinfo(); +-?> +------------------------------240723202011929-- +- +---FILE-- +-<?php +-error_reporting(0); +-print_r($_POST); +-print_r($_FILES); +-?> +---EXPECTF-- +-Array +-( +- [entry] => entry box +- [password] => password box +- [radio1] => test 1 +- [checkbox1] => test 1 +- [choices] => Choice 2 +-) +-Array +-( +- [file] => Array +- ( +- [name] => info.php +- [type] => application/octet-stream +- [tmp_name] => %s +- [error] => 0 +- [size] => 21 +- ) +- +-) +diff --git a/sapi/tests/test007.phpt b/sapi/tests/test007.phpt +deleted file mode 100644 +index 8c50e4b..0000000 +--- a/sapi/tests/test007.phpt ++++ /dev/null +@@ -1,46 +0,0 @@ +---TEST-- +-Multipart Form POST Data, incorrect content length +---HEADERS-- +-return <<<END +-Content-Type=multipart/form-data; boundary=---------------------------240723202011929 +-Content-Length=100 +-END; +---POST-- +------------------------------240723202011929 +-Content-Disposition: form-data; name="entry" +- +-entry box +------------------------------240723202011929 +-Content-Disposition: form-data; name="password" +- +-password box +------------------------------240723202011929 +-Content-Disposition: form-data; name="radio1" +- +-test 1 +------------------------------240723202011929 +-Content-Disposition: form-data; name="checkbox1" +- +-test 1 +------------------------------240723202011929 +-Content-Disposition: form-data; name="choices" +- +-Choice 1 +------------------------------240723202011929 +-Content-Disposition: form-data; name="choices" +- +-Choice 2 +------------------------------240723202011929 +-Content-Disposition: form-data; name="file"; filename="info.php" +-Content-Type: application/octet-stream +- +-<?php +-phpinfo(); +-?> +------------------------------240723202011929-- +- +---FILE-- +-<?php +-print @$_POST['choices']; +-?> +---EXPECT-- +diff --git a/ext/phar/tests/tar/phar_commitwrite.phpt b/ext/phar/tests/tar/phar_commitwrite.phpt +index 262ea1d..bfbac61 100644 +--- a/ext/phar/tests/tar/phar_commitwrite.phpt ++++ b/ext/phar/tests/tar/phar_commitwrite.phpt +@@ -5,9 +5,6 @@ + --INI-- + phar.require_hash=0 + phar.readonly=0 +---ENV-- +-TEMP=. +-TMP=. + --FILE-- + <?php + $p = new Phar(dirname(__FILE__) . '/brandnewphar.phar.tar', 0, 'brandnewphar.phar'); +diff --git a/ext/phar/tests/tar/phar_setsignaturealgo2.phpt b/ext/phar/tests/tar/phar_setsignaturealgo2.phpt +index b68bbf6..c16e752 100644 +--- a/ext/phar/tests/tar/phar_setsignaturealgo2.phpt ++++ b/ext/phar/tests/tar/phar_setsignaturealgo2.phpt +@@ -9,9 +9,6 @@ + --INI-- + phar.require_hash=0 + phar.readonly=0 +---ENV-- +-TEMP=. +-TMP=. + --FILE-- + <?php + $fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.tar'; +diff --git a/ext/phar/tests/zip/phar_commitwrite.phpt b/ext/phar/tests/zip/phar_commitwrite.phpt +index 4e18a6b..eb3aeae 100644 +--- a/ext/phar/tests/zip/phar_commitwrite.phpt ++++ b/ext/phar/tests/zip/phar_commitwrite.phpt +@@ -5,9 +5,6 @@ + --INI-- + phar.require_hash=0 + phar.readonly=0 +---ENV-- +-TEMP=. +-TMP=. + --FILE-- + <?php + $p = new Phar(dirname(__FILE__) . '/brandnewphar.phar.zip', 0, 'brandnewphar.phar'); +diff --git a/ext/standard/string.c b/ext/standard/string.c +index 569452c..9b75adc 100644 +--- a/ext/standard/string.c ++++ b/ext/standard/string.c +@@ -4770,7 +4770,7 @@ + if (state == 4) { + /* Inside <!-- comment --> */ + break; +- } else if (state == 2 && *(p-1) != '\\') { ++ } else if (state == 2 && p >= buf + 1 && *(p-1) != '\\') { + if (lc == c) { + lc = '\0'; + } else if (lc != '\\') { +@@ -4797,7 +4797,7 @@ + + case '!': + /* JavaScript & Other HTML scripting languages */ +- if (state == 1 && *(p-1) == '<') { ++ if (state == 1 && p >= buf + 1 && *(p-1) == '<') { + state = 3; + lc = c; + } else { +@@ -4824,7 +4824,7 @@ + + case '?': + +- if (state == 1 && *(p-1) == '<') { ++ if (state == 1 && p >= buf + 1 && *(p-1) == '<') { + br=0; + state=2; + break; +--- /dev/null ++++ b/ext/standard/tests/file/bug79099.phpt +@@ -0,0 +1,32 @@ ++--TEST-- ++Bug #79099 (OOB read in php_strip_tags_ex) ++--FILE-- ++<?php ++$stream = fopen('php://memory', 'w+'); ++fputs($stream, "<?\n\"\n"); ++rewind($stream); ++var_dump(fgetss($stream)); ++var_dump(fgetss($stream)); ++fclose($stream); ++ ++$stream = fopen('php://memory', 'w+'); ++fputs($stream, "<\0\n!\n"); ++rewind($stream); ++var_dump(fgetss($stream)); ++var_dump(fgetss($stream)); ++fclose($stream); ++ ++$stream = fopen('php://memory', 'w+'); ++fputs($stream, "<\0\n?\n"); ++rewind($stream); ++var_dump(fgetss($stream)); ++var_dump(fgetss($stream)); ++fclose($stream); ++?> ++--EXPECT-- ++string(0) "" ++string(0) "" ++string(0) "" ++string(0) "" ++string(0) "" ++string(0) "" +diff --git a/ext/mbstring/libmbfl/filters/mbfilter_big5.c b/ext/mbstring/libmbfl/filters/mbfilter_big5.c +index 099f8e6..e04d81d 100644 +--- a/ext/mbstring/libmbfl/filters/mbfilter_big5.c ++++ b/ext/mbstring/libmbfl/filters/mbfilter_big5.c +@@ -138,6 +138,17 @@ + {0xf70f,0xf848,0xc740,0xc8fe}, + }; + ++static inline int is_in_cp950_pua(int c1, int c) { ++ if ((c1 >= 0xfa && c1 <= 0xfe) || (c1 >= 0x8e && c1 <= 0xa0) || ++ (c1 >= 0x81 && c1 <= 0x8d) || (c1 >= 0xc7 && c1 <= 0xc8)) { ++ return (c >=0x40 && c <= 0x7e) || (c >= 0xa1 && c <= 0xfe); ++ } ++ if (c1 == 0xc6) { ++ return c >= 0xa1 && c <= 0xfe; ++ } ++ return 0; ++} ++ + /* + * Big5 => wchar + */ +@@ -186,11 +197,7 @@ + + if (filter->from->no_encoding == mbfl_no_encoding_cp950) { + /* PUA for CP950 */ +- if (w <= 0 && +- (((c1 >= 0xfa && c1 <= 0xfe) || (c1 >= 0x8e && c1 <= 0xa0) || +- (c1 >= 0x81 && c1 <= 0x8d) ||(c1 >= 0xc7 && c1 <= 0xc8)) +- && ((c > 0x39 && c < 0x7f) || (c > 0xa0 && c < 0xff))) || +- ((c1 == 0xc6) && (c > 0xa0 && c < 0xff))) { ++ if (w <= 0 && is_in_cp950_pua(c1, c)) { + c2 = c1 << 8 | c; + for (k = 0; k < sizeof(cp950_pua_tbl)/(sizeof(unsigned short)*4); k++) { + if (c2 >= cp950_pua_tbl[k][2] && c2 <= cp950_pua_tbl[k][3]) { +--- /dev/null ++++ b/ext/mbstring/tests/bug79037.phpt +@@ -0,0 +1,10 @@ ++--TEST-- ++Bug #79037: global buffer-overflow in `mbfl_filt_conv_big5_wchar` ++--FILE-- ++<?php ++ ++var_dump(mb_convert_encoding("\x81\x3a", "UTF-8", "CP950")); ++ ++?> ++--EXPECT-- ++string(1) "?" +diff --git a/ext/standard/string.c b/ext/standard/string.c +index 9b75adc..4687b20 100644 +--- a/ext/standard/string.c ++++ b/ext/standard/string.c +@@ -4720,7 +4720,7 @@ + switch (state) { + case 1: /* HTML/XML */ + lc = '>'; +- if (is_xml && *(p -1) == '-') { ++ if (is_xml && p >= buf + 1 && *(p-1) == '-') { + break; + } + in_q = state = is_xml = 0; +@@ -4741,7 +4741,7 @@ + break; + + case 2: /* PHP */ +- if (!br && lc != '\"' && *(p-1) == '?') { ++ if (!br && lc != '\"' && p >= buf + 1 && *(p-1) == '?') { + in_q = state = 0; + tp = tbuf; + } +diff --git a/ext/session/session.c b/ext/session/session.c +index 5380d2b..2fe9651 100644 +--- a/ext/session/session.c ++++ b/ext/session/session.c +@@ -2820,9 +2820,11 @@ + if (PS(rfc1867_cleanup)) { + php_session_rfc1867_cleanup(progress TSRMLS_CC); + } else { +- add_assoc_bool_ex(progress->data, "done", sizeof("done"), 1); +- Z_LVAL_P(progress->post_bytes_processed) = data->post_bytes_processed; +- php_session_rfc1867_update(progress, 1 TSRMLS_CC); ++ if (progress->data) { ++ add_assoc_bool_ex(progress->data, "done", sizeof("done"), 1); ++ Z_LVAL_P(progress->post_bytes_processed) = data->post_bytes_processed; ++ php_session_rfc1867_update(progress, 1 TSRMLS_CC); ++ } + } + php_rshutdown_session_globals(TSRMLS_C); + } +--- /dev/null ++++ b/ext/session/tests/bug79221.phpt +@@ -0,0 +1,45 @@ ++--TEST-- ++Null Pointer Dereference in PHP Session Upload Progress ++--INI-- ++error_reporting=0 ++file_uploads=1 ++upload_max_filesize=1024 ++session.save_path= ++session.name=PHPSESSID ++session.serialize_handler=php ++session.use_strict_mode=0 ++session.use_cookies=1 ++session.use_only_cookies=0 ++session.upload_progress.enabled=1 ++session.upload_progress.cleanup=0 ++session.upload_progress.prefix=upload_progress_ ++session.upload_progress.name=PHP_SESSION_UPLOAD_PROGRESS ++session.upload_progress.freq=1% ++session.upload_progress.min_freq=0.000000001 ++--COOKIE-- ++PHPSESSID=session-upload ++--POST_RAW-- ++Content-Type: multipart/form-data; boundary=---------------------------20896060251896012921717172737 ++-----------------------------20896060251896012921717172737 ++Content-Disposition: form-data; name="PHPSESSID" ++ ++session-upload ++-----------------------------20896060251896012921717172737 ++Content-Disposition: form-data; name="PHP_SESSION_UPLOAD_PROGRESS" ++ ++ryat ++-----------------------------20896060251896012921717172737 ++Content-Disposition: form-data; file="file"; ryat="filename" ++ ++1 ++-----------------------------20896060251896012921717172737-- ++--FILE-- ++<?php ++ ++session_start(); ++var_dump($_SESSION); ++session_destroy(); ++ ++--EXPECTF-- ++array(0) { ++} +diff --git a/ext/phar/phar_object.c b/ext/phar/phar_object.c +index d698372..5722828 100644 +--- a/ext/phar/phar_object.c ++++ b/ext/phar/phar_object.c +@@ -1427,6 +1427,7 @@ + zend_class_entry *ce = p_obj->c; + phar_archive_object *phar_obj = p_obj->p; + char *str = "[stream]"; ++ php_stream_statbuf ssb; + + iter->funcs->get_current_data(iter, &value TSRMLS_CC); + +@@ -1709,6 +1710,16 @@ + php_stream_copy_to_stream_ex(fp, p_obj->fp, PHP_STREAM_COPY_ALL, &contents_len); + data->internal_file->uncompressed_filesize = data->internal_file->compressed_filesize = + php_stream_tell(p_obj->fp) - data->internal_file->offset; ++ if (php_stream_stat(fp, &ssb) != -1) { ++ data->internal_file->flags = ssb.sb.st_mode & PHAR_ENT_PERM_MASK ; ++ } else { ++#ifndef _WIN32 ++ mode_t mask; ++ mask = umask(0); ++ umask(mask); ++ data->internal_file->flags &= ~mask; ++#endif ++ } + } + + if (close_fp) { +--- /dev/null ++++ b/ext/phar/tests/bug79082.phpt +@@ -0,0 +1,52 @@ ++--TEST-- ++Phar: Bug #79082: Files added to tar with Phar::buildFromIterator have all-access permissions ++--SKIPIF-- ++<?php ++if (!extension_loaded("phar")) die("skip"); ++if (defined("PHP_WINDOWS_VERSION_MAJOR")) die("skip not for Windows") ++?> ++--FILE-- ++<?php ++umask(022); ++var_dump(decoct(umask())); ++chmod(__DIR__ . '/test79082/test79082-testfile', 0644); ++chmod(__DIR__ . '/test79082/test79082-testfile2', 0400); ++ ++foreach([Phar::TAR => 'tar', Phar::ZIP => 'zip'] as $mode => $ext) { ++ clearstatcache(); ++ $phar = new PharData(__DIR__ . '/test79082.' . $ext, null, null, $mode); ++ $phar->buildFromIterator(new \RecursiveDirectoryIterator(__DIR__ . '/test79082', \FilesystemIterator::SKIP_DOTS), __DIR__ . '/test79082'); ++ $phar->extractTo(__DIR__); ++ var_dump(decoct(stat(__DIR__ . '/test79082-testfile')['mode'])); ++ var_dump(decoct(stat(__DIR__ . '/test79082-testfile2')['mode'])); ++ unlink(__DIR__ . '/test79082-testfile'); ++ unlink(__DIR__ . '/test79082-testfile2'); ++} ++foreach([Phar::TAR => 'tar', Phar::ZIP => 'zip'] as $mode => $ext) { ++ clearstatcache(); ++ $phar = new PharData(__DIR__ . '/test79082-d.' . $ext, null, null, $mode); ++ $phar->buildFromDirectory(__DIR__ . '/test79082'); ++ $phar->extractTo(__DIR__); ++ var_dump(decoct(stat(__DIR__ . '/test79082-testfile')['mode'])); ++ var_dump(decoct(stat(__DIR__ . '/test79082-testfile2')['mode'])); ++ unlink(__DIR__ . '/test79082-testfile'); ++ unlink(__DIR__ . '/test79082-testfile2'); ++} ++?> ++--CLEAN-- ++<? ++unlink(__DIR__ . '/test79082.tar'); ++unlink(__DIR__ . '/test79082.zip'); ++unlink(__DIR__ . '/test79082-d.tar'); ++unlink(__DIR__ . '/test79082-d.zip'); ++?> ++--EXPECT-- ++string(2) "22" ++string(6) "100644" ++string(6) "100400" ++string(6) "100644" ++string(6) "100400" ++string(6) "100644" ++string(6) "100400" ++string(6) "100644" ++string(6) "100400" +--- /dev/null ++++ b/ext/phar/tests/test79082/test79082-testfile +@@ -0,0 +1 @@ ++test +--- /dev/null ++++ b/ext/phar/tests/test79082/test79082-testfile2 +@@ -0,0 +1 @@ ++test +--- a/ext/openssl/tests/bug54992-ca.pem ++++ b/ext/openssl/tests/bug54992-ca.pem +@@ -1,35 +1,35 @@ + -----BEGIN CERTIFICATE----- +-MIIGAzCCA+ugAwIBAgIUZ7ZvvfVqSEf1EswMT9LfMIPc/U8wDQYJKoZIhvcNAQEL ++MIIGAzCCA+ugAwIBAgIUYS9Vq4aNK1hL5reofVRkM3ioENEwDQYJKoZIhvcNAQEL + BQAwgZAxCzAJBgNVBAYTAlBUMQ8wDQYDVQQIDAZMaXNib2ExDzANBgNVBAcMBkxp + c2JvYTEXMBUGA1UECgwOUEhQIEZvdW5kYXRpb24xHjAcBgNVBAMMFVJvb3QgQ0Eg + Zm9yIFBIUCBUZXN0czEmMCQGCSqGSIb3DQEJARYXaW50ZXJuYWxzQGxpc3RzLnBo +-cC5uZXQwHhcNMTgxMjMxMDg0NDU3WhcNMjAwMjA0MDg0NDU3WjCBkDELMAkGA1UE ++cC5uZXQwHhcNMjAwMjE4MDg1NTQ5WhcNMjEwMzI0MDg1NTQ5WjCBkDELMAkGA1UE + BhMCUFQxDzANBgNVBAgMBkxpc2JvYTEPMA0GA1UEBwwGTGlzYm9hMRcwFQYDVQQK + DA5QSFAgRm91bmRhdGlvbjEeMBwGA1UEAwwVUm9vdCBDQSBmb3IgUEhQIFRlc3Rz + MSYwJAYJKoZIhvcNAQkBFhdpbnRlcm5hbHNAbGlzdHMucGhwLm5ldDCCAiIwDQYJ +-KoZIhvcNAQEBBQADggIPADCCAgoCggIBAPVThsunmhda5hbNi+pXD3WF9ijryB9H +-JDnIbPW/vMffWcQgtiRzc+6aCykBygnhnN91NNRpxOsoLCb7OjUMM0TjhSE9DxKD +-aVLRoDcs5VSaddQjq3AwdkU6ek9InUOeDuZ8gatrpWlEyuQPwwnMAfR9NkcTajuF +-hGO0BlqkHg98GckQD0N5x6CrrDJt6RE6hf9gUZSGSWdPTiETBQUN8LTuxo/ybFSN +-hcpVNCF+r3eozATbSU8YvQU52RmPIZWHHmYb7KtMO3TEX4LnLJUOefUK4qk+ZJ0s +-f4JfnY7RhBlZGh2kIyE5jwqz8/KzKtxrutNaupdTFZO8nX09QSgmDCxVWVclrPaG +-q2ZFYpeauTy71pTm8DjF7PwQI/+PUrBdFIX0V6uxqUEG0pvPdb8zenVbaK4Jh39u +-w0V5tH/rbtd7zZX4vl3bmKo1Wk0SQxd83iXitxLiJnWNOsmrJcM/Hx91kE10+/ly +-zgL/w5A9HSA616kfPdNzny0laH1TXVLJsnyyV3DyfnU4O6VI0JG3WjhgRdMkgobn +-GvGJ2ZsZAxds9lBtT2y+gw5BU+jkSilPk3jM9MA7Kmyci93U9xxMuDNzyUzfcnXR +-UIq99dZWeMMy1LT3buZXrAWu1WRgPdQtDKcQHDIQaIkxlWsT8q2q/wIirb6fwxlw +-vXkFp+aEP35BAgMBAAGjUzBRMB0GA1UdDgQWBBR37F1+W1gcCp8bhZaFFi9JKQhu +-tTAfBgNVHSMEGDAWgBR37F1+W1gcCp8bhZaFFi9JKQhutTAPBgNVHRMBAf8EBTAD +-AQH/MA0GCSqGSIb3DQEBCwUAA4ICAQAYHqpISUI/x8UW33i35rYkFYNvXBMQDc8J +-v4G2eqEBNCOVmHg6P//lq1F2jrtAEr/saESN1uS1Q80sUsthlVsceV1z1isdpugG +-kMbfHxLe0QpthnP3PEChQw30TPB22BThuGVkteNSZKTCPGdzjSTPq2kOR6PCBZRd +-r0r/TW3lT/Ng3KgjT6g7E3ZUpAeFEQMlmNYr/eEOL7K+1jzQrbCLmXbs6rmtffr7 +-n4p+wMPMPaSRqQoQ86ff9GPzxWuAQGlytVoiS5Xt3jotd/RWlOy0YQ2QSzOQvFUW +-4te5lwdOvOFnJTo43U3DqASqMcaazvIsN41zVlOyOyKEr9oZERju6FU1aZmuZtHQ +-wMCmXVj/Swj67Zp9tG+vVQenbEk314+8c2nenuOIFP1F2C/NG3vMLIpENRGxpmAm +-s5gIT6mXvJ4JCwWYc75zucOr2KVkDmEziJh/pARuOrOAPdc6NjKku8HBC9UI96+x +-Db4hG2SqXUzShkFX/px7vlCADvgO3FDk2aiyW02PFsItob2O6OB98VGsU26hgRO/ +-Czz/jbjWTPHNOt6/fcL0m7XLwlJ+K9gRArY15DeJGumcHEq/Vd/Z8iPQKKdzgF4O +-9XFZvu+VHP82AS5TeiYHCddFJyzktQYcNu5/OBuxzO83d7rpqrLFETTEOL4cN8O7 +-LJ7Q89hYAQ== ++KoZIhvcNAQEBBQADggIPADCCAgoCggIBALlJlfDasmObBQiQSsyDVRu0uwVmFFZ7 ++fqFVHUMeKpWv0Y3dH5FtpBoMOh41XYI7E1Ex9UTNIYsRedESzEm1DIBsKHHODRsj ++gJVH3jxAEmDPaNQJ0x4zlNmmd7Zz74lo/eJ+oc2rLiJd3NVKCXEWtu2mO5FN/x3Z ++vG+QXkT04tGvwLn4oAdiU4zlf0ttO5xY5GjUXhT6XfZyveceLb4QFowtCTmS1IFf ++eUoybHvjCYyNm9m1B/x297VV73rDvWx7+ptkwG46L5UeG/lrLhnStzM1dxSlENUL ++OGmjFfk00jrRnftat8x31lAa0cFYXudkHpMLxFHprRgsQL+1URjl0nyVT2MLmcit ++kfIMXjRaScJsj+KgW1pymVlIO2qf16Wk4wLubW8/AkSmmSv9ilJeppn7Qh/OuZyj ++epsFX19VdERg42yI0/QIs4cgCvgddlnGuJBDGU5BVFPDYc2BevRvd/x48bDFHJ4w ++dhNrMa9jGDSc8niZ/spK4lE6d7JqFUHuQa2jL8PG5+NcYaftJQAlJt25ze1Km7QO ++pJgRNdEqOp8hcJmfgYbQxGb6s74nMTp+iKOjMLNf1n37QxTPYfKTWP4xnKiva9aA ++jGUMADNgtlFSZt5JaTnEk9m33Nh4FN/siX01+rX4FQ2csIIAQ42Xu/+PRUUYHqXe ++/xGgOhZE9YgZAgMBAAGjUzBRMB0GA1UdDgQWBBSr92+pGtY4Fc5beZWCSzf5FGf9 ++mTAfBgNVHSMEGDAWgBSr92+pGtY4Fc5beZWCSzf5FGf9mTAPBgNVHRMBAf8EBTAD ++AQH/MA0GCSqGSIb3DQEBCwUAA4ICAQCwHTpBGbcnCZc+Y0DLN1mxPOKgcrIHUDQt ++kFaRt901sK9fxhjeOmtcMOxDsVg23BKZ7A+sGkRDa0pxtwqZzrk4r96htJB0mV2y ++zskRjDg8UEjgm2BFFc1ikqHOcidJ0WG6/LSpzR9w6QhAtMpbWLrfS0yIfr9MKywS ++7rOt82USg9Ca8qQxosIUkkatugVjJIjaBbVSREHtaRyDjGqVvB8P6EwESB2Ymltm +++S6LDv0b6NNQyeOLp2fp8JcJmQh5liqcIp0yDVJI8oEppHHkFcROmq/w0cm0Ct/C ++XW+Us2nW5/tVdhm0X2HHN8IItmZEDdM2+AVDoYyKKy13twnClc/0imYoK0I+ARUv ++mF85OmJhODaYhsU8gXwTfnghI4b9Hg++jSRl+jwrvaxwBI+tDGrRCvWCr1T/xVrg ++G8w3MmtIY9MaEyiutK24TeYuR3bMlJqHaQaufm9YTT5vp5MjumUpC4FPM+2JQa1y ++wdAUWyBqHhJF5X4AdVFxcAOHqah1hoky9sUARYd50z85/PhgKH/P2zO5F37NwYSR ++n+DIZDP4AKZ6QEPL8QlteT0EPacZSucwNheSboHFJmT39gGntxSw1hdNcwQ5yaa6 ++QMhMfo/w9/i2Yg55RBd5RZCWPb2IlA5RC3qbjPNMC8XrEvhSHOcWTXsfccYgXGeO ++XHgucRqlJg== + -----END CERTIFICATE----- +diff --git a/ext/openssl/tests/bug54992.pem b/ext/openssl/tests/bug54992.pem +index f207c30..148d06d 100644 +--- a/ext/openssl/tests/bug54992.pem ++++ b/ext/openssl/tests/bug54992.pem +@@ -1,26 +1,26 @@ + -----BEGIN CERTIFICATE----- +-MIID7jCCAdYCFDw0rvm7q8y5HfispK5A2I2+RBqHMA0GCSqGSIb3DQEBCwUAMIGQ ++MIID7jCCAdYCFEG0vY25vkfkH6Jllbh6eAIsffxMMA0GCSqGSIb3DQEBCwUAMIGQ + MQswCQYDVQQGEwJQVDEPMA0GA1UECAwGTGlzYm9hMQ8wDQYDVQQHDAZMaXNib2Ex + FzAVBgNVBAoMDlBIUCBGb3VuZGF0aW9uMR4wHAYDVQQDDBVSb290IENBIGZvciBQ + SFAgVGVzdHMxJjAkBgkqhkiG9w0BCQEWF2ludGVybmFsc0BsaXN0cy5waHAubmV0 +-MB4XDTE4MTIzMTA4NDY0M1oXDTIwMDIwNDA4NDY0M1owWjEXMBUGA1UEAxMOYnVn ++MB4XDTIwMDIxODA4NTYwMVoXDTIxMDMyNDA4NTYwMVowWjEXMBUGA1UEAxMOYnVn + NTQ5OTIubG9jYWwxCzAJBgNVBAYTAlBUMQ8wDQYDVQQHEwZMaXNib2ExDzANBgNV + BAgTBkxpc2JvYTEQMA4GA1UEChMHcGhwLm5ldDCBnzANBgkqhkiG9w0BAQEFAAOB + jQAwgYkCgYEAtUAVQKTgpUPgtFOJ3w3kDJETS45tWeT96kUg1NeYLKW+jNbFhxPo + PJv7XhfemCaqh2tbq1cdYW906Wp1L+eNQvdTYA2IQG4EQBUlmfyIakOIMsN/RizV + kF09vlNQwTpaMpqTv7wB8vvwbxb9jbC2ZhQUBEg6PIn18dSstbM9FZ0CAwEAATAN +-BgkqhkiG9w0BAQsFAAOCAgEAKtSMguV5ZQ2KpdZ9MAFa+GiHL0APb58OrvwNK4BF +-6032UZLOWnsBZlo85WGLNnIT/GNzKKr7n9jHeuZcBVOFQLsebahSlfJZs9FPatlI +-9Md1tRzVoTKohjG86HeFhhL+gZQ69SdIcK40wpH1qNv7KyMGA8gnx6rRKbOxZqsx +-pkA/wS7CTqP9/DeOxh/MZPg7N/GZXW1QOz+SE537E9iyiRsbldNYFtwn5iaVfjpr +-xz09wYYW3HJpR+QKPCfJ79JxDhuMHMoUOpIy8vGFnt5zVTcFLa378Sy3vCT1Qwvt +-tTavFGHby4A7OqT6xu+9GTW37OaiV91UelLLV0+MoR4XiMVMX76mvqzmKCp6L9ae +-7RYHrrCtNxkYUKUSkOEc2VHnT+sENkJIZu7zzN7/QNlc0yE9Rtsmgy4QAxo2m9u0 +-pUZLAulZ1lS7g/sr7/8Pp17RDvJiJh+oAPyVYZ7OoLF1IoHDHcZI0bqcqhDhiHZs +-PXYqyMCxyYzHFOAOgvbrEkmp8z/E8ATVwdUbAYN1dMrYHre1P4HFEtJh2QiGG2KE +-4jheuNhH1R25AizbwYbD33Kdp7ltCgBlfYqjl771SlgY45QYs0mUdc1Pv39SGIwf +-ZUm7mOWjaTBdYANrkvGM5NNT9kESjKkWykyTg4UF5rHV6nlyexR4b3fjabroi4BS +-v6w= ++BgkqhkiG9w0BAQsFAAOCAgEAmcDl/X+0murSKko+Arl6RFfOB+fpuGeKtS9UAZcH ++w/v7kCvBeRTKs+/BAWbdu3MPXFw4dqvHn+2De/7Fx5yN/KznZnn/aFkGaBWcevQC ++qdGxf9/4SoB+x0fGDuEuZZ/TGiT4V0l7xhx9HBsud5HYt9vFnJDEgSoxlOFDoR13 ++6Jefe5kOnHX0dvPuJuZcXquV+5llTYp6clUQkcA8NOuegFEOoM/J5GAYfgHeRtrB ++vjbpIKgIixBUbOwPsrmb3btitPFDT7a1FWNtHmOb1Ij6r+ga6J60Iefr1AfMwnd5 ++D6W3E4ztEL9N4RK+uBz5zRk1usFEHw+TaCA4x9xVUXdY8r6ei1xnO9nwA9C1062F ++EVy/HpyxZlrdzFsLWHEWyOnshCdozU14dlkNgc9LImKsMJ+T18GkrF5KtN6NB4tc ++8Zeo7usEWHkwlacKGOr0V3gflU6EfPkQHEsSBSvbzuJ2pej17mqVqdzaRsGliRsC ++P/2cEcxtmoig7rTrS0sBVXLgqxpwBNLEfOKkWVAzBpR86gfGNnJbt3GMPLxma2oP ++tfTUMW4OuUR2GsszDwMmkmNhc7EduJyhcu3BwHChmIW/kbbz32aAFTQnDGO/Dj0G ++f/cROxREv3wCOMZsk56JezZ4F1nWZYcQ2m6xrzyN6DBzc13dQ3Wq9lTJ2vZM8i5E ++jp0= + -----END CERTIFICATE----- + -----BEGIN RSA PRIVATE KEY----- + MIICXgIBAAKBgQC1QBVApOClQ+C0U4nfDeQMkRNLjm1Z5P3qRSDU15gspb6M1sWH +diff --git a/ext/openssl/tests/bug65538.phar b/ext/openssl/tests/bug65538.phar +index 9215a78..a5fefcd 100644 +--- a/ext/openssl/tests/bug65538.phar ++++ b/ext/openssl/tests/bug65538.phar +@@ -289,64 +289,64 @@ + } + + Extract_Phar::go(); +-__HALT_COMPILER(); ?>e +-MIIGAzCCA+ugAwIBAgIUZ7ZvvfVqSEf1EswMT9LfMIPc/U8wDQYJKoZIhvcNAQEL ++__HALT_COMPILER(); ?>e ++MIIGAzCCA+ugAwIBAgIUYS9Vq4aNK1hL5reofVRkM3ioENEwDQYJKoZIhvcNAQEL + BQAwgZAxCzAJBgNVBAYTAlBUMQ8wDQYDVQQIDAZMaXNib2ExDzANBgNVBAcMBkxp + c2JvYTEXMBUGA1UECgwOUEhQIEZvdW5kYXRpb24xHjAcBgNVBAMMFVJvb3QgQ0Eg + Zm9yIFBIUCBUZXN0czEmMCQGCSqGSIb3DQEJARYXaW50ZXJuYWxzQGxpc3RzLnBo +-cC5uZXQwHhcNMTgxMjMxMDg0NDU3WhcNMjAwMjA0MDg0NDU3WjCBkDELMAkGA1UE ++cC5uZXQwHhcNMjAwMjE4MDg1NTQ5WhcNMjEwMzI0MDg1NTQ5WjCBkDELMAkGA1UE + BhMCUFQxDzANBgNVBAgMBkxpc2JvYTEPMA0GA1UEBwwGTGlzYm9hMRcwFQYDVQQK + DA5QSFAgRm91bmRhdGlvbjEeMBwGA1UEAwwVUm9vdCBDQSBmb3IgUEhQIFRlc3Rz + MSYwJAYJKoZIhvcNAQkBFhdpbnRlcm5hbHNAbGlzdHMucGhwLm5ldDCCAiIwDQYJ +-KoZIhvcNAQEBBQADggIPADCCAgoCggIBAPVThsunmhda5hbNi+pXD3WF9ijryB9H +-JDnIbPW/vMffWcQgtiRzc+6aCykBygnhnN91NNRpxOsoLCb7OjUMM0TjhSE9DxKD +-aVLRoDcs5VSaddQjq3AwdkU6ek9InUOeDuZ8gatrpWlEyuQPwwnMAfR9NkcTajuF +-hGO0BlqkHg98GckQD0N5x6CrrDJt6RE6hf9gUZSGSWdPTiETBQUN8LTuxo/ybFSN +-hcpVNCF+r3eozATbSU8YvQU52RmPIZWHHmYb7KtMO3TEX4LnLJUOefUK4qk+ZJ0s +-f4JfnY7RhBlZGh2kIyE5jwqz8/KzKtxrutNaupdTFZO8nX09QSgmDCxVWVclrPaG +-q2ZFYpeauTy71pTm8DjF7PwQI/+PUrBdFIX0V6uxqUEG0pvPdb8zenVbaK4Jh39u +-w0V5tH/rbtd7zZX4vl3bmKo1Wk0SQxd83iXitxLiJnWNOsmrJcM/Hx91kE10+/ly +-zgL/w5A9HSA616kfPdNzny0laH1TXVLJsnyyV3DyfnU4O6VI0JG3WjhgRdMkgobn +-GvGJ2ZsZAxds9lBtT2y+gw5BU+jkSilPk3jM9MA7Kmyci93U9xxMuDNzyUzfcnXR +-UIq99dZWeMMy1LT3buZXrAWu1WRgPdQtDKcQHDIQaIkxlWsT8q2q/wIirb6fwxlw +-vXkFp+aEP35BAgMBAAGjUzBRMB0GA1UdDgQWBBR37F1+W1gcCp8bhZaFFi9JKQhu +-tTAfBgNVHSMEGDAWgBR37F1+W1gcCp8bhZaFFi9JKQhutTAPBgNVHRMBAf8EBTAD +-AQH/MA0GCSqGSIb3DQEBCwUAA4ICAQAYHqpISUI/x8UW33i35rYkFYNvXBMQDc8J +-v4G2eqEBNCOVmHg6P//lq1F2jrtAEr/saESN1uS1Q80sUsthlVsceV1z1isdpugG +-kMbfHxLe0QpthnP3PEChQw30TPB22BThuGVkteNSZKTCPGdzjSTPq2kOR6PCBZRd +-r0r/TW3lT/Ng3KgjT6g7E3ZUpAeFEQMlmNYr/eEOL7K+1jzQrbCLmXbs6rmtffr7 +-n4p+wMPMPaSRqQoQ86ff9GPzxWuAQGlytVoiS5Xt3jotd/RWlOy0YQ2QSzOQvFUW +-4te5lwdOvOFnJTo43U3DqASqMcaazvIsN41zVlOyOyKEr9oZERju6FU1aZmuZtHQ +-wMCmXVj/Swj67Zp9tG+vVQenbEk314+8c2nenuOIFP1F2C/NG3vMLIpENRGxpmAm +-s5gIT6mXvJ4JCwWYc75zucOr2KVkDmEziJh/pARuOrOAPdc6NjKku8HBC9UI96+x +-Db4hG2SqXUzShkFX/px7vlCADvgO3FDk2aiyW02PFsItob2O6OB98VGsU26hgRO/ +-Czz/jbjWTPHNOt6/fcL0m7XLwlJ+K9gRArY15DeJGumcHEq/Vd/Z8iPQKKdzgF4O +-9XFZvu+VHP82AS5TeiYHCddFJyzktQYcNu5/OBuxzO83d7rpqrLFETTEOL4cN8O7 +-LJ7Q89hYAQ== ++KoZIhvcNAQEBBQADggIPADCCAgoCggIBALlJlfDasmObBQiQSsyDVRu0uwVmFFZ7 ++fqFVHUMeKpWv0Y3dH5FtpBoMOh41XYI7E1Ex9UTNIYsRedESzEm1DIBsKHHODRsj ++gJVH3jxAEmDPaNQJ0x4zlNmmd7Zz74lo/eJ+oc2rLiJd3NVKCXEWtu2mO5FN/x3Z ++vG+QXkT04tGvwLn4oAdiU4zlf0ttO5xY5GjUXhT6XfZyveceLb4QFowtCTmS1IFf ++eUoybHvjCYyNm9m1B/x297VV73rDvWx7+ptkwG46L5UeG/lrLhnStzM1dxSlENUL ++OGmjFfk00jrRnftat8x31lAa0cFYXudkHpMLxFHprRgsQL+1URjl0nyVT2MLmcit ++kfIMXjRaScJsj+KgW1pymVlIO2qf16Wk4wLubW8/AkSmmSv9ilJeppn7Qh/OuZyj ++epsFX19VdERg42yI0/QIs4cgCvgddlnGuJBDGU5BVFPDYc2BevRvd/x48bDFHJ4w ++dhNrMa9jGDSc8niZ/spK4lE6d7JqFUHuQa2jL8PG5+NcYaftJQAlJt25ze1Km7QO ++pJgRNdEqOp8hcJmfgYbQxGb6s74nMTp+iKOjMLNf1n37QxTPYfKTWP4xnKiva9aA ++jGUMADNgtlFSZt5JaTnEk9m33Nh4FN/siX01+rX4FQ2csIIAQ42Xu/+PRUUYHqXe ++/xGgOhZE9YgZAgMBAAGjUzBRMB0GA1UdDgQWBBSr92+pGtY4Fc5beZWCSzf5FGf9 ++mTAfBgNVHSMEGDAWgBSr92+pGtY4Fc5beZWCSzf5FGf9mTAPBgNVHRMBAf8EBTAD ++AQH/MA0GCSqGSIb3DQEBCwUAA4ICAQCwHTpBGbcnCZc+Y0DLN1mxPOKgcrIHUDQt ++kFaRt901sK9fxhjeOmtcMOxDsVg23BKZ7A+sGkRDa0pxtwqZzrk4r96htJB0mV2y ++zskRjDg8UEjgm2BFFc1ikqHOcidJ0WG6/LSpzR9w6QhAtMpbWLrfS0yIfr9MKywS ++7rOt82USg9Ca8qQxosIUkkatugVjJIjaBbVSREHtaRyDjGqVvB8P6EwESB2Ymltm +++S6LDv0b6NNQyeOLp2fp8JcJmQh5liqcIp0yDVJI8oEppHHkFcROmq/w0cm0Ct/C ++XW+Us2nW5/tVdhm0X2HHN8IItmZEDdM2+AVDoYyKKy13twnClc/0imYoK0I+ARUv ++mF85OmJhODaYhsU8gXwTfnghI4b9Hg++jSRl+jwrvaxwBI+tDGrRCvWCr1T/xVrg ++G8w3MmtIY9MaEyiutK24TeYuR3bMlJqHaQaufm9YTT5vp5MjumUpC4FPM+2JQa1y ++wdAUWyBqHhJF5X4AdVFxcAOHqah1hoky9sUARYd50z85/PhgKH/P2zO5F37NwYSR ++n+DIZDP4AKZ6QEPL8QlteT0EPacZSucwNheSboHFJmT39gGntxSw1hdNcwQ5yaa6 ++QMhMfo/w9/i2Yg55RBd5RZCWPb2IlA5RC3qbjPNMC8XrEvhSHOcWTXsfccYgXGeO ++XHgucRqlJg== + -----END CERTIFICATE----- + -----BEGIN CERTIFICATE----- +-MIID7jCCAdYCFDw0rvm7q8y5HfispK5A2I2+RBqHMA0GCSqGSIb3DQEBCwUAMIGQ ++MIID7jCCAdYCFEG0vY25vkfkH6Jllbh6eAIsffxMMA0GCSqGSIb3DQEBCwUAMIGQ + MQswCQYDVQQGEwJQVDEPMA0GA1UECAwGTGlzYm9hMQ8wDQYDVQQHDAZMaXNib2Ex + FzAVBgNVBAoMDlBIUCBGb3VuZGF0aW9uMR4wHAYDVQQDDBVSb290IENBIGZvciBQ + SFAgVGVzdHMxJjAkBgkqhkiG9w0BCQEWF2ludGVybmFsc0BsaXN0cy5waHAubmV0 +-MB4XDTE4MTIzMTA4NDY0M1oXDTIwMDIwNDA4NDY0M1owWjEXMBUGA1UEAxMOYnVn ++MB4XDTIwMDIxODA4NTYwMVoXDTIxMDMyNDA4NTYwMVowWjEXMBUGA1UEAxMOYnVn + NTQ5OTIubG9jYWwxCzAJBgNVBAYTAlBUMQ8wDQYDVQQHEwZMaXNib2ExDzANBgNV + BAgTBkxpc2JvYTEQMA4GA1UEChMHcGhwLm5ldDCBnzANBgkqhkiG9w0BAQEFAAOB + jQAwgYkCgYEAtUAVQKTgpUPgtFOJ3w3kDJETS45tWeT96kUg1NeYLKW+jNbFhxPo + PJv7XhfemCaqh2tbq1cdYW906Wp1L+eNQvdTYA2IQG4EQBUlmfyIakOIMsN/RizV + kF09vlNQwTpaMpqTv7wB8vvwbxb9jbC2ZhQUBEg6PIn18dSstbM9FZ0CAwEAATAN +-BgkqhkiG9w0BAQsFAAOCAgEAKtSMguV5ZQ2KpdZ9MAFa+GiHL0APb58OrvwNK4BF +-6032UZLOWnsBZlo85WGLNnIT/GNzKKr7n9jHeuZcBVOFQLsebahSlfJZs9FPatlI +-9Md1tRzVoTKohjG86HeFhhL+gZQ69SdIcK40wpH1qNv7KyMGA8gnx6rRKbOxZqsx +-pkA/wS7CTqP9/DeOxh/MZPg7N/GZXW1QOz+SE537E9iyiRsbldNYFtwn5iaVfjpr +-xz09wYYW3HJpR+QKPCfJ79JxDhuMHMoUOpIy8vGFnt5zVTcFLa378Sy3vCT1Qwvt +-tTavFGHby4A7OqT6xu+9GTW37OaiV91UelLLV0+MoR4XiMVMX76mvqzmKCp6L9ae +-7RYHrrCtNxkYUKUSkOEc2VHnT+sENkJIZu7zzN7/QNlc0yE9Rtsmgy4QAxo2m9u0 +-pUZLAulZ1lS7g/sr7/8Pp17RDvJiJh+oAPyVYZ7OoLF1IoHDHcZI0bqcqhDhiHZs +-PXYqyMCxyYzHFOAOgvbrEkmp8z/E8ATVwdUbAYN1dMrYHre1P4HFEtJh2QiGG2KE +-4jheuNhH1R25AizbwYbD33Kdp7ltCgBlfYqjl771SlgY45QYs0mUdc1Pv39SGIwf +-ZUm7mOWjaTBdYANrkvGM5NNT9kESjKkWykyTg4UF5rHV6nlyexR4b3fjabroi4BS +-v6w= ++BgkqhkiG9w0BAQsFAAOCAgEAmcDl/X+0murSKko+Arl6RFfOB+fpuGeKtS9UAZcH ++w/v7kCvBeRTKs+/BAWbdu3MPXFw4dqvHn+2De/7Fx5yN/KznZnn/aFkGaBWcevQC ++qdGxf9/4SoB+x0fGDuEuZZ/TGiT4V0l7xhx9HBsud5HYt9vFnJDEgSoxlOFDoR13 ++6Jefe5kOnHX0dvPuJuZcXquV+5llTYp6clUQkcA8NOuegFEOoM/J5GAYfgHeRtrB ++vjbpIKgIixBUbOwPsrmb3btitPFDT7a1FWNtHmOb1Ij6r+ga6J60Iefr1AfMwnd5 ++D6W3E4ztEL9N4RK+uBz5zRk1usFEHw+TaCA4x9xVUXdY8r6ei1xnO9nwA9C1062F ++EVy/HpyxZlrdzFsLWHEWyOnshCdozU14dlkNgc9LImKsMJ+T18GkrF5KtN6NB4tc ++8Zeo7usEWHkwlacKGOr0V3gflU6EfPkQHEsSBSvbzuJ2pej17mqVqdzaRsGliRsC ++P/2cEcxtmoig7rTrS0sBVXLgqxpwBNLEfOKkWVAzBpR86gfGNnJbt3GMPLxma2oP ++tfTUMW4OuUR2GsszDwMmkmNhc7EduJyhcu3BwHChmIW/kbbz32aAFTQnDGO/Dj0G ++f/cROxREv3wCOMZsk56JezZ4F1nWZYcQ2m6xrzyN6DBzc13dQ3Wq9lTJ2vZM8i5E ++jp0= + -----END CERTIFICATE----- + -----BEGIN RSA PRIVATE KEY----- + MIICXgIBAAKBgQC1QBVApOClQ+C0U4nfDeQMkRNLjm1Z5P3qRSDU15gspb6M1sWH +@@ -363,4 +363,4 @@ + FqU0zPvrnBZ6Zwlgm2cSVQJAPLYA51Z9piajbTuggpioQ5qbUEDkJjmYHbm8eJnK + h5NW/EtCk4SBxAc+8ElPrvJjtZyOPWfm4vZF5sDKtC3Fkg== + -----END RSA PRIVATE KEY----- +-ݬ;lÊ5aOi`uÉaB¢äbR +\ No newline at end of file ++‚yýzyø‘‹kýi•e‘œ¹H +\ No newline at end of file +diff --git a/ext/openssl/tests/openssl_peer_fingerprint_basic.phpt b/ext/openssl/tests/openssl_peer_fingerprint_basic.phpt +index 3bca7cb..015c291 100644 +--- a/ext/openssl/tests/openssl_peer_fingerprint_basic.phpt ++++ b/ext/openssl/tests/openssl_peer_fingerprint_basic.phpt +@@ -36,13 +36,13 @@ + // openssl x509 -noout -fingerprint -md5 -inform pem -in ext/openssl/tests/bug54992.pem | cut -d '=' -f 2 | tr -d ':' | tr 'A-F' 'a-f' + // Currently it's 4edbbaf40a6a4b6af22b6d6d9818378f + // One below is intentionally broken (compare the last character): +- stream_context_set_option($clientCtx, 'ssl', 'peer_fingerprint', '4edbbaf40a6a4b6af22b6d6d98183780'); ++ stream_context_set_option($clientCtx, 'ssl', 'peer_fingerprint', '8054dab6e0412bdd8190226fd213d190'); + var_dump(stream_socket_client($serverUri, $errno, $errstr, 2, $clientFlags, $clientCtx)); + + // Run the following to get actual sha256 (from sources root): + // openssl x509 -noout -fingerprint -sha256 -inform pem -in ext/openssl/tests/bug54992.pem | cut -d '=' -f 2 | tr -d ':' | tr 'A-F' 'a-f' + stream_context_set_option($clientCtx, 'ssl', 'peer_fingerprint', [ +- 'sha256' => 'b1d480a2f83594fa243d26378cf611f334d369e59558d87e3de1abe8f36cb997', ++ 'sha256' => '06941b4f4f00523f6c81b69ad4424b3506320285a8b1bd084c112435a12ff487', + ]); + var_dump(stream_socket_client($serverUri, $errno, $errstr, 2, $clientFlags, $clientCtx)); + CODE; +diff --git a/ext/exif/exif.c b/ext/exif/exif.c +index f64a14e..bf2fd61 100644 +--- a/ext/exif/exif.c ++++ b/ext/exif/exif.c +@@ -3253,6 +3253,11 @@ + { + unsigned exif_value_2a, offset_of_ifd; + ++ if (length < 2) { ++ exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_WARNING, "Missing TIFF alignment marker"); ++ return; ++ } ++ + /* set the thumbnail stuff to nothing so we can test to see if they get set up */ + if (memcmp(CharBuf, "II", 2) == 0) { + ImageInfo->motorola_intel = 0; +@@ -3405,7 +3410,7 @@ + return FALSE; + } + +- sn = exif_file_sections_add(ImageInfo, marker, itemlen+1, NULL); ++ sn = exif_file_sections_add(ImageInfo, marker, itemlen, NULL); + Data = ImageInfo->file.list[sn].data; + + /* Store first two pre-read bytes. */ +--- /dev/null ++++ b/ext/exif/tests/bug79282.phpt +@@ -0,0 +1,15 @@ ++--TEST-- ++Bug #79282: Use-of-uninitialized-value in exif ++--FILE-- ++<?php ++ ++var_dump(exif_read_data('data://image/jpeg;base64,/9jhAAlFeGlmAAAg')); ++ ++?> ++--EXPECTF-- ++Warning: exif_read_data(): Invalid TIFF alignment marker in %s on line %d ++ ++Warning: exif_read_data(): File structure corrupted in %s on line %d ++ ++Warning: exif_read_data(): Invalid JPEG file in %s on line %d ++bool(false) +diff --git a/ext/standard/url.c b/ext/standard/url.c +index 6ecace5..d6e71fa 100644 +--- a/ext/standard/url.c ++++ b/ext/standard/url.c +@@ -675,7 +675,7 @@ + HashTable *hashT; + long format = 0; + +- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &url, &url_len, &format) == FAILURE) { ++ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p|l", &url, &url_len, &format) == FAILURE) { + return; + } + context = FG(default_context) ? FG(default_context) : (FG(default_context) = php_stream_context_alloc(TSRMLS_C)); +diff --git a/ext/standard/exec.c b/ext/standard/exec.c +index 88a6b4a..a586b78 100644 +--- a/ext/standard/exec.c ++++ b/ext/standard/exec.c +@@ -537,6 +537,15 @@ + return; + } + ++ if (!command_len) { ++ php_error_docref(NULL, E_WARNING, "Cannot execute a blank command"); ++ RETURN_FALSE; ++ } ++ if (strlen(command) != command_len) { ++ php_error_docref(NULL, E_WARNING, "NULL byte detected. Possible attack"); ++ RETURN_FALSE; ++ } ++ + #ifdef PHP_WIN32 + if ((in=VCWD_POPEN(command, "rt"))==NULL) { + #else +diff --git a/ext/standard/url.c b/ext/standard/url.c +index d6e71fa..0278bd4 100644 +--- a/ext/standard/url.c ++++ b/ext/standard/url.c +@@ -545,7 +545,7 @@ + #ifndef CHARSET_EBCDIC + *dest = (char) php_htoi(data + 1); + #else +- *dest = os_toebcdic[(char) php_htoi(data + 1)]; ++ *dest = os_toebcdic[(unsigned char) php_htoi(data + 1)]; + #endif + data += 2; + len -= 2; +@@ -647,7 +647,7 @@ + #ifndef CHARSET_EBCDIC + *dest = (char) php_htoi(data + 1); + #else +- *dest = os_toebcdic[(char) php_htoi(data + 1)]; ++ *dest = os_toebcdic[(unsigned char) php_htoi(data + 1)]; + #endif + data += 2; + len -= 2; +--- /dev/null ++++ b/ext/openssl/tests/bug72333.phpt +@@ -0,0 +1,54 @@ ++--TEST-- ++Bug #72333: fwrite() on non-blocking SSL sockets doesn't work ++--SKIPIF-- ++<?php ++if (!extension_loaded("openssl")) die("skip openssl not loaded"); ++if (!function_exists("proc_open")) die("skip no proc_open"); ++?> ++--FILE-- ++<?php ++$serverCode = <<<'CODE' ++ $context = stream_context_create(['ssl' => ['local_cert' => __DIR__ . '/bug54992.pem']]); ++ ++ $flags = STREAM_SERVER_BIND|STREAM_SERVER_LISTEN; ++ $fp = stream_socket_server("ssl://127.0.0.1:10011", $errornum, $errorstr, $flags, $context); ++ phpt_notify(); ++ $conn = stream_socket_accept($fp); ++ ++ for ($i = 0; $i < 5; $i++) { ++ fread($conn, 100000); ++ usleep(200000); ++ } ++CODE; ++ ++$clientCode = <<<'CODE' ++ $context = stream_context_create(['ssl' => ['verify_peer' => false, 'peer_name' => 'bug54992.local']]); ++ ++ phpt_wait(); ++ $fp = stream_socket_client("ssl://127.0.0.1:10011", $errornum, $errorstr, 3000, STREAM_CLIENT_CONNECT, $context); ++ stream_set_blocking($fp, 0); ++ ++ function blocking_fwrite($fp, $buf) { ++ $write = [$fp]; ++ $total = 0; ++ while (stream_select($read, $write, $except, 180)) { ++ $result = fwrite($fp, $buf); ++ $total += $result; ++ if ($total >= strlen($buf)) { ++ return $total; ++ } ++ $buf = substr($buf, $total); ++ } ++ } ++ ++ $str1 = str_repeat("a", 5000000); ++ blocking_fwrite($fp, $str1); ++ echo "done"; ++CODE; ++ ++include 'ServerClientTestCase.inc'; ++ServerClientTestCase::getInstance()->run($clientCode, $serverCode); ++?> ++--EXPECT-- ++done ++ +diff --git a/ext/openssl/xp_ssl.c b/ext/openssl/xp_ssl.c +index c2d477c..6a7dcd7 100644 +--- a/ext/openssl/xp_ssl.c ++++ b/ext/openssl/xp_ssl.c +@@ -1714,6 +1714,14 @@ + + if (SUCCESS == php_set_sock_blocking(sslsock->s.socket, 0 TSRMLS_CC)) { + sslsock->s.is_blocked = 0; ++ SSL_set_mode( ++ sslsock->ssl_handle, ++ ( ++ SSL_get_mode(sslsock->ssl_handle) | ++ SSL_MODE_ENABLE_PARTIAL_WRITE | ++ SSL_MODE_ACCEPT_MOVING_WRITE_BUFFER ++ ) ++ ); + } + + timeout = sslsock->is_client ? &sslsock->connect_timeout : &sslsock->s.timeout; +diff --git a/Zend/zend_multiply.h b/Zend/zend_multiply.h +index a4d48b1..850c108 100644 +--- a/Zend/zend_multiply.h ++++ b/Zend/zend_multiply.h +@@ -62,8 +62,8 @@ + __asm__("mul %0, %2, %3\n" \ + "smulh %1, %2, %3\n" \ + "sub %1, %1, %0, asr #63\n" \ +- : "=X"(__tmpvar), "=X"(usedval) \ +- : "X"(a), "X"(b)); \ ++ : "=&r"(__tmpvar), "=&r"(usedval) \ ++ : "r"(a), "r"(b)); \ + if (usedval) (dval) = (double) (a) * (double) (b); \ + else (lval) = __tmpvar; \ + } while (0) +diff --git a/ext/zip/php_zip.c b/ext/zip/php_zip.c +index 52f058c..8fa14f3 100644 +--- a/ext/zip/php_zip.c ++++ b/ext/zip/php_zip.c +@@ -1572,6 +1572,21 @@ + ze_obj->filename = NULL; + } + ++#if LIBZIP_VERSION_MAJOR > 1 || LIBZIP_VERSION_MAJOR == 1 && LIBZIP_VERSION_MINOR >= 6 ++ /* reduce BC break introduce in libzip 1.6.0 ++ "Do not accept empty files as valid zip archives any longer" */ ++ ++ /* open for write without option to empty the archive */ ++ if ((flags & (ZIP_TRUNCATE | ZIP_RDONLY)) == 0) { ++ struct stat st; ++ ++ /* exists and is empty */ ++ if (VCWD_STAT(resolved_path, &st) == 0 && st.st_size == 0) { ++ flags |= ZIP_TRUNCATE; ++ } ++ } ++#endif ++ + intern = zip_open(resolved_path, flags, &err); + if (!intern || err) { + efree(resolved_path); +--- a/main/rfc1867.c ++++ b/main/rfc1867.c +@@ -609,9 +609,9 @@ + } + + /* read until a boundary condition */ +-static int multipart_buffer_read(multipart_buffer *self, char *buf, int bytes, int *end TSRMLS_DC) ++static unsigned int multipart_buffer_read(multipart_buffer *self, char *buf, unsigned int bytes, int *end TSRMLS_DC) + { +- int len, max; ++ unsigned int len, max; + char *bound; + + /* fill buffer if needed */ +@@ -658,7 +658,7 @@ + static char *multipart_buffer_read_body(multipart_buffer *self, unsigned int *len TSRMLS_DC) + { + char buf[FILLUNIT], *out=NULL; +- int total_bytes=0, read_bytes=0; ++ unsigned int total_bytes=0, read_bytes=0; + + while((read_bytes = multipart_buffer_read(self, buf, sizeof(buf), NULL TSRMLS_CC))) { + out = erealloc(out, total_bytes + read_bytes + 1); +@@ -684,7 +684,8 @@ + { + char *boundary, *s = NULL, *boundary_end = NULL, *start_arr = NULL, *array_index = NULL; + char *temp_filename = NULL, *lbuf = NULL, *abuf = NULL; +- int boundary_len = 0, cancel_upload = 0, is_arr_upload = 0, array_len = 0; ++ int boundary_len = 0, cancel_upload = 0, is_arr_upload = 0; ++ unsigned int array_len = 0; + int64_t total_bytes = 0, max_file_size = 0; + int skip_upload = 0, anonindex = 0, is_anonymous; + zval *http_post_files = NULL; +--- a/ext/standard/image.c ++++ b/ext/standard/image.c +@@ -1398,6 +1398,11 @@ + return; + } + ++ if (mode == FROM_PATH && CHECK_NULL_PATH(input, input_len)) { ++ php_error_docref(NULL, E_WARNING, "Invalid path"); ++ return; ++ } ++ + if (argc == 2) { + zval_dtor(*info); + array_init(*info); +diff --git a/Zend/zend_dtrace.c b/Zend/zend_dtrace.c +index 51bd1f4..9e58fd2 100644 +--- a/Zend/zend_dtrace.c ++++ b/Zend/zend_dtrace.c +@@ -23,6 +23,11 @@ + #include "zend_dtrace.h" + + #ifdef HAVE_DTRACE ++ ++ZEND_API zend_op_array *(*zend_dtrace_compile_file)(zend_file_handle *file_handle, int type TSRMLS_DC); ++ZEND_API void (*zend_dtrace_execute)(zend_op_array *op_array TSRMLS_DC); ++ZEND_API void (*zend_dtrace_execute_internal)(zend_execute_data *execute_data_ptr, zend_fcall_info *fci, int return_value_used TSRMLS_DC); ++ + /* PHP DTrace probes {{{ */ + static inline const char *dtrace_get_executed_filename(TSRMLS_D) + { +@@ -103,4 +108,3 @@ + + /* }}} */ + #endif /* HAVE_DTRACE */ +- +diff --git a/Zend/zend_dtrace.h b/Zend/zend_dtrace.h +index 26008af..2ed6095 100644 +--- a/Zend/zend_dtrace.h ++++ b/Zend/zend_dtrace.h +@@ -30,9 +30,9 @@ + #endif + + #ifdef HAVE_DTRACE +-ZEND_API zend_op_array *(*zend_dtrace_compile_file)(zend_file_handle *file_handle, int type TSRMLS_DC); +-ZEND_API void (*zend_dtrace_execute)(zend_op_array *op_array TSRMLS_DC); +-ZEND_API void (*zend_dtrace_execute_internal)(zend_execute_data *execute_data_ptr, zend_fcall_info *fci, int return_value_used TSRMLS_DC); ++ZEND_API extern zend_op_array *(*zend_dtrace_compile_file)(zend_file_handle *file_handle, int type TSRMLS_DC); ++ZEND_API extern void (*zend_dtrace_execute)(zend_op_array *op_array TSRMLS_DC); ++ZEND_API extern void (*zend_dtrace_execute_internal)(zend_execute_data *execute_data_ptr, zend_fcall_info *fci, int return_value_used TSRMLS_DC); + + ZEND_API zend_op_array *dtrace_compile_file(zend_file_handle *file_handle, int type TSRMLS_DC); + ZEND_API void dtrace_execute_ex(zend_execute_data *execute_data TSRMLS_DC); +diff --git a/main/php_variables.c b/main/php_variables.c +index 6da79bd..084b10f 100644 +--- a/main/php_variables.c ++++ b/main/php_variables.c +@@ -472,7 +472,9 @@ + unsigned int new_val_len; + + *val++ = '\0'; +- php_url_decode(var, strlen(var)); ++ if (arg != PARSE_COOKIE) { ++ php_url_decode(var, strlen(var)); ++ } + val_len = php_url_decode(val, strlen(val)); + val = estrndup(val, val_len); + if (sapi_module.input_filter(arg, var, &val, val_len, &new_val_len TSRMLS_CC)) { +@@ -483,7 +485,9 @@ + int val_len; + unsigned int new_val_len; + +- php_url_decode(var, strlen(var)); ++ if (arg != PARSE_COOKIE) { ++ php_url_decode(var, strlen(var)); ++ } + val_len = 0; + val = estrndup("", val_len); + if (sapi_module.input_filter(arg, var, &val, val_len, &new_val_len TSRMLS_CC)) { +diff --git a/tests/basic/022.phpt b/tests/basic/022.phpt +index 0ab70d4..bd1db13 100644 +--- a/tests/basic/022.phpt ++++ b/tests/basic/022.phpt +@@ -10,7 +10,7 @@ + var_dump($_COOKIE); + ?> + --EXPECT-- +-array(10) { ++array(12) { + ["cookie1"]=> + string(6) "val1 " + ["cookie2"]=> +@@ -19,11 +19,15 @@ + string(6) "val 3." + ["cookie_4"]=> + string(10) " value 4 ;" ++ ["%20cookie1"]=> ++ string(6) "ignore" ++ ["+cookie1"]=> ++ string(6) "ignore" + ["cookie__5"]=> + string(7) " value" +- ["cookie_6"]=> ++ ["cookie%206"]=> + string(3) "þæö" +- ["cookie_7"]=> ++ ["cookie+7"]=> + string(0) "" + ["$cookie_8"]=> + string(0) "" +diff --git a/tests/basic/023.phpt b/tests/basic/023.phpt +index ca5f1dc..0e2e0ac 100644 +--- a/tests/basic/023.phpt ++++ b/tests/basic/023.phpt +@@ -10,9 +10,11 @@ + var_dump($_COOKIE); + ?> + --EXPECT-- +-array(3) { ++array(4) { + ["c_o_o_k_i_e"]=> + string(5) "value" ++ ["c%20o+o_k+i%20e"]=> ++ string(1) "v" + ["name"]=> + string(24) ""value","value",UEhQIQ==" + ["UEhQIQ"]=> +--- /dev/null ++++ b/tests/basic/bug79699.phpt +@@ -0,0 +1,22 @@ ++--TEST-- ++Cookies Security Bug ++--INI-- ++max_input_vars=1000 ++filter.default=unsafe_raw ++--COOKIE-- ++__%48ost-evil=evil; __Host-evil=good; %66oo=baz;foo=bar ++--FILE-- ++<?php ++var_dump($_COOKIE); ++?> ++--EXPECT-- ++array(4) { ++ ["__%48ost-evil"]=> ++ string(4) "evil" ++ ["__Host-evil"]=> ++ string(4) "good" ++ ["%66oo"]=> ++ string(3) "baz" ++ ["foo"]=> ++ string(3) "bar" ++} +diff --git a/ext/standard/tests/strings/url_t.phpt b/ext/standard/tests/strings/url_t.phpt +index e172061..80e164a 100644 +--- a/ext/standard/tests/strings/url_t.phpt ++++ b/ext/standard/tests/strings/url_t.phpt +@@ -575,15 +575,13 @@ + string(16) "some_page_ref123" + } + +---> http://secret@hideout@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123: array(7) { ++--> http://secret@hideout@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123: array(6) { + ["scheme"]=> + string(4) "http" + ["host"]=> +- string(11) "www.php.net" ++ string(26) "secret@hideout@www.php.net" + ["port"]=> + int(80) +- ["user"]=> +- string(14) "secret@hideout" + ["path"]=> + string(10) "/index.php" + ["query"]=> +--- /dev/null ++++ b/ext/standard/tests/url/bug77423.phpt +@@ -0,0 +1,30 @@ ++--TEST-- ++Bug #77423 (parse_url() will deliver a wrong host to user) ++--FILE-- ++<?php ++$urls = array( ++ "http://php.net\@aliyun.com/aaa.do", ++ "https://example.com\uFF03@bing.com", ++); ++foreach ($urls as $url) { ++ var_dump(filter_var($url, FILTER_VALIDATE_URL)); ++ var_dump(parse_url($url)); ++} ++?> ++--EXPECT-- ++bool(false) ++array(3) { ++ ["scheme"]=> ++ string(4) "http" ++ ["host"]=> ++ string(19) "php.net\@aliyun.com" ++ ["path"]=> ++ string(7) "/aaa.do" ++} ++bool(false) ++array(2) { ++ ["scheme"]=> ++ string(5) "https" ++ ["host"]=> ++ string(26) "example.com\uFF03@bing.com" ++} +diff --git a/ext/standard/tests/url/parse_url_basic_001.phpt b/ext/standard/tests/url/parse_url_basic_001.phpt +index e468066..c9e9d32 100644 +--- a/ext/standard/tests/url/parse_url_basic_001.phpt ++++ b/ext/standard/tests/url/parse_url_basic_001.phpt +@@ -507,15 +507,13 @@ + string(16) "some_page_ref123" + } + +---> http://secret@hideout@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123: array(7) { ++--> http://secret@hideout@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123: array(6) { + ["scheme"]=> + string(4) "http" + ["host"]=> +- string(11) "www.php.net" ++ string(26) "secret@hideout@www.php.net" + ["port"]=> + int(80) +- ["user"]=> +- string(14) "secret@hideout" + ["path"]=> + string(10) "/index.php" + ["query"]=> +diff --git a/ext/standard/tests/url/parse_url_basic_003.phpt b/ext/standard/tests/url/parse_url_basic_003.phpt +index 70dc4bb..431de27 100644 +--- a/ext/standard/tests/url/parse_url_basic_003.phpt ++++ b/ext/standard/tests/url/parse_url_basic_003.phpt +@@ -68,7 +68,7 @@ + --> http://secret:@www.php.net/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(11) "www.php.net" + --> http://:hideout@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(11) "www.php.net" + --> http://secret:hideout@www.php.net/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(11) "www.php.net" +---> http://secret@hideout@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(11) "www.php.net" ++--> http://secret@hideout@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(26) "secret@hideout@www.php.net" + --> http://secret:hid:out@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(11) "www.php.net" + --> nntp://news.php.net : string(12) "news.php.net" + --> ftp://ftp.gnu.org/gnu/glic/glibc.tar.gz : string(11) "ftp.gnu.org" +diff --git a/ext/standard/tests/url/parse_url_basic_005.phpt b/ext/standard/tests/url/parse_url_basic_005.phpt +index b2ca06f..b2c1a1d 100644 +--- a/ext/standard/tests/url/parse_url_basic_005.phpt ++++ b/ext/standard/tests/url/parse_url_basic_005.phpt +@@ -68,7 +68,7 @@ + --> http://secret:@www.php.net/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(6) "secret" + --> http://:hideout@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(0) "" + --> http://secret:hideout@www.php.net/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(6) "secret" +---> http://secret@hideout@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(14) "secret@hideout" ++--> http://secret@hideout@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : NULL + --> http://secret:hid:out@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(6) "secret" + --> nntp://news.php.net : NULL + --> ftp://ftp.gnu.org/gnu/glic/glibc.tar.gz : NULL +diff --git a/ext/standard/url.c b/ext/standard/url.c +index 0278bd4..8da9da3 100644 +--- a/ext/standard/url.c ++++ b/ext/standard/url.c +@@ -92,6 +92,22 @@ + return php_url_parse_ex(str, strlen(str)); + } + ++static int is_userinfo_valid(const char *str, size_t len) ++{ ++ char *valid = "-._~!$&'()*+,;=:"; ++ char *p = str; ++ while (p - str < len) { ++ if (isalpha(*p) || isdigit(*p) || strchr(valid, *p)) { ++ p++; ++ } else if (*p == '%' && p - str <= len - 3 && isdigit(*(p+1)) && isxdigit(*(p+2))) { ++ p += 3; ++ } else { ++ return 0; ++ } ++ } ++ return 1; ++} ++ + /* {{{ php_url_parse + */ + PHPAPI php_url *php_url_parse_ex(char const *str, int length) +@@ -230,13 +246,18 @@ + ret->pass = estrndup(pp, (p-pp)); + php_replace_controlchars_ex(ret->pass, (p-pp)); + } else { ++ if (!is_userinfo_valid(s, p-s)) { ++ goto check_port; ++ } + ret->user = estrndup(s, (p-s)); + php_replace_controlchars_ex(ret->user, (p-s)); ++ + } + + s = p + 1; + } + ++check_port: + /* check for port */ + if (s < ue && *s == '[' && *(e-1) == ']') { + /* Short circuit portscan, +--- a/ext/soap/php_sdl.c ++++ b/ext/soap/php_sdl.c +@@ -318,6 +318,8 @@ + ctx->context = NULL; + } + ++#define SAFE_STR(a) ((a)?a:"") ++ + static void load_wsdl_ex(zval *this_ptr, char *struri, sdlCtx *ctx, int include TSRMLS_DC) + { + sdlPtr tmpsdl = ctx->sdl; +@@ -379,7 +381,7 @@ + if (node_is_equal_ex(trav2, "schema", XSD_NAMESPACE)) { + load_schema(ctx, trav2 TSRMLS_CC); + } else if (is_wsdl_element(trav2) && !node_is_equal(trav2,"documentation")) { +- soap_error1(E_ERROR, "Parsing WSDL: Unexpected WSDL element <%s>", trav2->name); ++ soap_error1(E_ERROR, "Parsing WSDL: Unexpected WSDL element <%s>", SAFE_STR(trav2->name)); + } + trav2 = trav2->next; + } +@@ -440,7 +442,7 @@ + soap_error0(E_ERROR, "Parsing WSDL: <service> has no name attribute"); + } + } else if (!node_is_equal(trav,"documentation")) { +- soap_error1(E_ERROR, "Parsing WSDL: Unexpected WSDL element <%s>", trav->name); ++ soap_error1(E_ERROR, "Parsing WSDL: Unexpected WSDL element <%s>", SAFE_STR(trav->name)); + } + trav = trav->next; + } +@@ -550,7 +552,7 @@ + } + smart_str_free(&key); + } else if (is_wsdl_element(trav) && !node_is_equal(trav,"documentation")) { +- soap_error1(E_ERROR, "Parsing WSDL: Unexpected WSDL element <%s>", trav->name); ++ soap_error1(E_ERROR, "Parsing WSDL: Unexpected WSDL element <%s>", SAFE_STR(trav->name)); + } + trav = trav->next; + } +@@ -655,7 +657,7 @@ + } + smart_str_free(&key); + } else if (is_wsdl_element(trav) && !node_is_equal(trav,"documentation")) { +- soap_error1(E_ERROR, "Parsing WSDL: Unexpected WSDL element <%s>", trav->name); ++ soap_error1(E_ERROR, "Parsing WSDL: Unexpected WSDL element <%s>", SAFE_STR(trav->name)); + } + trav = trav->next; + } +@@ -687,14 +689,14 @@ + sdlParamPtr param; + + if (trav->ns != NULL && strcmp((char*)trav->ns->href, WSDL_NAMESPACE) != 0) { +- soap_error1(E_ERROR, "Parsing WSDL: Unexpected extensibility element <%s>", trav->name); ++ soap_error1(E_ERROR, "Parsing WSDL: Unexpected extensibility element <%s>", SAFE_STR(trav->name)); + } + if (node_is_equal(trav,"documentation")) { + trav = trav->next; + continue; + } + if (!node_is_equal(trav,"part")) { +- soap_error1(E_ERROR, "Parsing WSDL: Unexpected WSDL element <%s>", trav->name); ++ soap_error1(E_ERROR, "Parsing WSDL: Unexpected WSDL element <%s>", SAFE_STR(trav->name)); + } + part = trav; + param = emalloc(sizeof(sdlParam)); +@@ -703,7 +705,7 @@ + + name = get_attribute(part->properties, "name"); + if (name == NULL) { +- soap_error1(E_ERROR, "Parsing WSDL: No name associated with <part> '%s'", message->name); ++ soap_error1(E_ERROR, "Parsing WSDL: No name associated with <part> '%s'", SAFE_STR(message->name)); + } + + param->paramName = estrdup((char*)name->children->content); +@@ -773,7 +775,7 @@ + continue; + } + if (!node_is_equal(trav,"port")) { +- soap_error1(E_ERROR, "Parsing WSDL: Unexpected WSDL element <%s>", trav->name); ++ soap_error1(E_ERROR, "Parsing WSDL: Unexpected WSDL element <%s>", SAFE_STR(trav->name)); + } + + port = trav; +@@ -812,7 +814,7 @@ + } + } + if (trav2 != address && is_wsdl_element(trav2) && !node_is_equal(trav2,"documentation")) { +- soap_error1(E_ERROR, "Parsing WSDL: Unexpected WSDL element <%s>", trav2->name); ++ soap_error1(E_ERROR, "Parsing WSDL: Unexpected WSDL element <%s>", SAFE_STR(trav2->name)); + } + trav2 = trav2->next; + } +@@ -914,7 +916,7 @@ + continue; + } + if (!node_is_equal(trav2,"operation")) { +- soap_error1(E_ERROR, "Parsing WSDL: Unexpected WSDL element <%s>", trav2->name); ++ soap_error1(E_ERROR, "Parsing WSDL: Unexpected WSDL element <%s>", SAFE_STR(trav2->name)); + } + + operation = trav2; +@@ -933,7 +935,7 @@ + !node_is_equal(trav3,"output") && + !node_is_equal(trav3,"fault") && + !node_is_equal(trav3,"documentation")) { +- soap_error1(E_ERROR, "Parsing WSDL: Unexpected WSDL element <%s>", trav3->name); ++ soap_error1(E_ERROR, "Parsing WSDL: Unexpected WSDL element <%s>", SAFE_STR(trav3->name)); + } + trav3 = trav3->next; + } +@@ -1111,7 +1113,7 @@ + } + } + } else if (is_wsdl_element(trav) && !node_is_equal(trav,"documentation")) { +- soap_error1(E_ERROR, "Parsing WSDL: Unexpected WSDL element <%s>", trav->name); ++ soap_error1(E_ERROR, "Parsing WSDL: Unexpected WSDL element <%s>", SAFE_STR(trav->name)); + } + trav = trav->next; + } +diff --git a/ext/soap/php_xml.c b/ext/soap/php_xml.c +index f3b49df..4694b4e 100644 +--- a/ext/soap/php_xml.c ++++ b/ext/soap/php_xml.c +@@ -205,7 +205,7 @@ + + int attr_is_equal_ex(xmlAttrPtr node, char *name, char *ns) + { +- if (name == NULL || strcmp((char*)node->name, name) == 0) { ++ if (name == NULL || ((node->name) && strcmp((char*)node->name, name) == 0)) { + if (ns) { + xmlNsPtr nsPtr = attr_find_ns(node); + if (nsPtr) { +@@ -221,7 +221,7 @@ + + int node_is_equal_ex(xmlNodePtr node, char *name, char *ns) + { +- if (name == NULL || strcmp((char*)node->name, name) == 0) { ++ if (name == NULL || ((node->name) && strcmp((char*)node->name, name) == 0)) { + if (ns) { + xmlNsPtr nsPtr = node_find_ns(node); + if (nsPtr) { +--- /dev/null ++++ b/ext/soap/tests/bug80672.phpt +@@ -0,0 +1,15 @@ ++--TEST-- ++Bug #80672 Null Dereference in SoapClient ++--SKIPIF-- ++<?php require_once('skipif.inc'); ?> ++--FILE-- ++<?php ++try { ++ $client = new SoapClient(__DIR__ . "/bug80672.xml"); ++ $query = $soap->query(array('sXML' => 'something')); ++} catch(SoapFault $e) { ++ print $e->getMessage(); ++} ++?> ++--EXPECTF-- ++SOAP-ERROR: Parsing WSDL: Unexpected WSDL element <> +\ No newline at end of file +--- /dev/null ++++ b/ext/soap/tests/bug80672.xml +@@ -0,0 +1,6 @@ ++<?xml version="1.0" encoding="ISO-8859-1"?> ++<soap:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ++ xmlns:xsd="http://www.w3.org/2001/XMLSchema" ++ xmlns:soap="http://schemas.xmlsoap.org/wsdl/"> ++<![CDATA[test]]> ++</soap:definitions> +diff --git a/ext/imap/php_imap.c b/ext/imap/php_imap.c +index b30440f..5dfe122 100644 +--- a/ext/imap/php_imap.c ++++ b/ext/imap/php_imap.c +@@ -3491,6 +3491,21 @@ + } + /* }}} */ + ++static zend_bool header_injection(char *p, zend_bool adrlist) ++{ ++ while ((p = strpbrk(p, "\r\n")) != NULL) { ++ if (!(p[0] == '\r' && p[1] == '\n') ++ /* adrlists do not support folding, but swallow trailing line breaks */ ++ && !((adrlist && p[1] == '\0') ++ /* other headers support folding */ ++ || !adrlist && (p[1] == ' ' || p[1] == '\t'))) { ++ return 1; ++ } ++ p++; ++ } ++ return 0; ++} ++ + /* {{{ proto string imap_mail_compose(array envelope, array body) + Create a MIME message based on given envelope and body sections */ + PHP_FUNCTION(imap_mail_compose) +@@ -3511,6 +3526,13 @@ + return; + } + ++#define CHECK_HEADER_INJECTION(zstr, adrlist, header) \ ++ if (header_injection(zstr, adrlist)) { \ ++ php_error_docref(NULL TSRMLS_CC, E_WARNING, "header injection attempt in " header); \ ++ RETVAL_FALSE; \ ++ goto done; \ ++ } ++ + #define PHP_RFC822_PARSE_ADRLIST(target, value) \ + str_copy = estrndup(Z_STRVAL_PP(value), Z_STRLEN_PP(value)); \ + rfc822_parse_adrlist(target, str_copy, "NO HOST"); \ +@@ -3519,46 +3541,57 @@ + env = mail_newenvelope(); + if (zend_hash_find(Z_ARRVAL_P(envelope), "remail", sizeof("remail"), (void **) &pvalue)== SUCCESS) { + convert_to_string_ex(pvalue); ++ CHECK_HEADER_INJECTION(Z_STRVAL_PP(pvalue), 0, "remail"); + env->remail = cpystr(Z_STRVAL_PP(pvalue)); + } + if (zend_hash_find(Z_ARRVAL_P(envelope), "return_path", sizeof("return_path"), (void **) &pvalue)== SUCCESS) { + convert_to_string_ex(pvalue); ++ CHECK_HEADER_INJECTION(Z_STRVAL_PP(pvalue), 1, "return_path"); + PHP_RFC822_PARSE_ADRLIST(&env->return_path, pvalue); + } + if (zend_hash_find(Z_ARRVAL_P(envelope), "date", sizeof("date"), (void **) &pvalue)== SUCCESS) { + convert_to_string_ex(pvalue); ++ CHECK_HEADER_INJECTION(Z_STRVAL_PP(pvalue), 0, "date"); + env->date = cpystr(Z_STRVAL_PP(pvalue)); + } + if (zend_hash_find(Z_ARRVAL_P(envelope), "from", sizeof("from"), (void **) &pvalue)== SUCCESS) { + convert_to_string_ex(pvalue); ++ CHECK_HEADER_INJECTION(Z_STRVAL_PP(pvalue), 1, "from"); + PHP_RFC822_PARSE_ADRLIST(&env->from, pvalue); + } + if (zend_hash_find(Z_ARRVAL_P(envelope), "reply_to", sizeof("reply_to"), (void **) &pvalue)== SUCCESS) { + convert_to_string_ex(pvalue); ++ CHECK_HEADER_INJECTION(Z_STRVAL_PP(pvalue), 1, "reply_to"); + PHP_RFC822_PARSE_ADRLIST(&env->reply_to, pvalue); + } + if (zend_hash_find(Z_ARRVAL_P(envelope), "in_reply_to", sizeof("in_reply_to"), (void **) &pvalue)== SUCCESS) { + convert_to_string_ex(pvalue); ++ CHECK_HEADER_INJECTION(Z_STRVAL_PP(pvalue), 0, "in_reply_to"); + env->in_reply_to = cpystr(Z_STRVAL_PP(pvalue)); + } + if (zend_hash_find(Z_ARRVAL_P(envelope), "subject", sizeof("subject"), (void **) &pvalue)== SUCCESS) { + convert_to_string_ex(pvalue); ++ CHECK_HEADER_INJECTION(Z_STRVAL_PP(pvalue), 0, "subject"); + env->subject = cpystr(Z_STRVAL_PP(pvalue)); + } + if (zend_hash_find(Z_ARRVAL_P(envelope), "to", sizeof("to"), (void **) &pvalue)== SUCCESS) { + convert_to_string_ex(pvalue); ++ CHECK_HEADER_INJECTION(Z_STRVAL_PP(pvalue), 1, "to"); + PHP_RFC822_PARSE_ADRLIST(&env->to, pvalue); + } + if (zend_hash_find(Z_ARRVAL_P(envelope), "cc", sizeof("cc"), (void **) &pvalue)== SUCCESS) { + convert_to_string_ex(pvalue); ++ CHECK_HEADER_INJECTION(Z_STRVAL_PP(pvalue), 1, "cc"); + PHP_RFC822_PARSE_ADRLIST(&env->cc, pvalue); + } + if (zend_hash_find(Z_ARRVAL_P(envelope), "bcc", sizeof("bcc"), (void **) &pvalue)== SUCCESS) { + convert_to_string_ex(pvalue); ++ CHECK_HEADER_INJECTION(Z_STRVAL_PP(pvalue), 1, "bcc"); + PHP_RFC822_PARSE_ADRLIST(&env->bcc, pvalue); + } + if (zend_hash_find(Z_ARRVAL_P(envelope), "message_id", sizeof("message_id"), (void **) &pvalue)== SUCCESS) { + convert_to_string_ex(pvalue); ++ CHECK_HEADER_INJECTION(Z_STRVAL_PP(pvalue), 0, "message_id"); + env->message_id=cpystr(Z_STRVAL_PP(pvalue)); + } + +@@ -3568,6 +3601,7 @@ + while (zend_hash_get_current_data(Z_ARRVAL_PP(pvalue), (void **) &env_data) == SUCCESS) { + custom_headers_param = mail_newbody_parameter(); + convert_to_string_ex(env_data); ++ CHECK_HEADER_INJECTION(Z_STRVAL_PP(env_data), 0, "custom_headers"); + custom_headers_param->value = (char *) fs_get(Z_STRLEN_PP(env_data) + 1); + custom_headers_param->attribute = NULL; + memcpy(custom_headers_param->value, Z_STRVAL_PP(env_data), Z_STRLEN_PP(env_data) + 1); +@@ -3598,6 +3632,7 @@ + } + if (zend_hash_find(Z_ARRVAL_PP(data), "charset", sizeof("charset"), (void **) &pvalue)== SUCCESS) { + convert_to_string_ex(pvalue); ++ CHECK_HEADER_INJECTION(Z_STRVAL_PP(pvalue), 0, "body charset"); + tmp_param = mail_newbody_parameter(); + tmp_param->value = cpystr(Z_STRVAL_PP(pvalue)); + tmp_param->attribute = cpystr("CHARSET"); +@@ -3608,10 +3643,12 @@ + if(Z_TYPE_PP(pvalue) == IS_ARRAY) { + disp_param = tmp_param = NULL; + while (zend_hash_get_current_data(Z_ARRVAL_PP(pvalue), (void **) &disp_data) == SUCCESS) { ++ CHECK_HEADER_INJECTION(key, 0, "body disposition key"); + disp_param = mail_newbody_parameter(); + zend_hash_get_current_key(Z_ARRVAL_PP(pvalue), &key, &ind, 0); + disp_param->attribute = cpystr(key); + convert_to_string_ex(disp_data); ++ CHECK_HEADER_INJECTION(Z_STRVAL_PP(disp_data), 0, "body disposition value"); + disp_param->value = (char *) fs_get(Z_STRLEN_PP(disp_data) + 1); + memcpy(disp_param->value, Z_STRVAL_PP(disp_data), Z_STRLEN_PP(disp_data) + 1); + zend_hash_move_forward(Z_ARRVAL_PP(pvalue)); +@@ -3623,18 +3660,22 @@ + } + if (zend_hash_find(Z_ARRVAL_PP(data), "subtype", sizeof("subtype"), (void **) &pvalue)== SUCCESS) { + convert_to_string_ex(pvalue); ++ CHECK_HEADER_INJECTION(Z_STRVAL_PP(pvalue), 0, "body subtype"); + bod->subtype = cpystr(Z_STRVAL_PP(pvalue)); + } + if (zend_hash_find(Z_ARRVAL_PP(data), "id", sizeof("id"), (void **) &pvalue)== SUCCESS) { + convert_to_string_ex(pvalue); ++ CHECK_HEADER_INJECTION(Z_STRVAL_PP(pvalue), 0, "body id"); + bod->id = cpystr(Z_STRVAL_PP(pvalue)); + } + if (zend_hash_find(Z_ARRVAL_PP(data), "description", sizeof("description"), (void **) &pvalue)== SUCCESS) { + convert_to_string_ex(pvalue); ++ CHECK_HEADER_INJECTION(Z_STRVAL_PP(pvalue), 0, "body description"); + bod->description = cpystr(Z_STRVAL_PP(pvalue)); + } + if (zend_hash_find(Z_ARRVAL_PP(data), "disposition.type", sizeof("disposition.type"), (void **) &pvalue)== SUCCESS) { + convert_to_string_ex(pvalue); ++ CHECK_HEADER_INJECTION(Z_STRVAL_PP(pvalue), 0, "body disposition.type"); + bod->disposition.type = (char *) fs_get(Z_STRLEN_PP(pvalue) + 1); + memcpy(bod->disposition.type, Z_STRVAL_PP(pvalue), Z_STRLEN_PP(pvalue)+1); + } +@@ -3642,10 +3683,12 @@ + if (Z_TYPE_PP(pvalue) == IS_ARRAY) { + disp_param = tmp_param = NULL; + while (zend_hash_get_current_data(Z_ARRVAL_PP(pvalue), (void **) &disp_data) == SUCCESS) { ++ CHECK_HEADER_INJECTION(key, 0, "body type.parameters key"); + disp_param = mail_newbody_parameter(); + zend_hash_get_current_key(Z_ARRVAL_PP(pvalue), &key, &ind, 0); + disp_param->attribute = cpystr(key); + convert_to_string_ex(disp_data); ++ CHECK_HEADER_INJECTION(Z_STRVAL_PP(disp_data), 0, "body type.parameters value"); + disp_param->value = (char *) fs_get(Z_STRLEN_PP(disp_data) + 1); + memcpy(disp_param->value, Z_STRVAL_PP(disp_data), Z_STRLEN_PP(disp_data) + 1); + zend_hash_move_forward(Z_ARRVAL_PP(pvalue)); +@@ -3675,6 +3718,7 @@ + } + if (zend_hash_find(Z_ARRVAL_PP(data), "md5", sizeof("md5"), (void **) &pvalue)== SUCCESS) { + convert_to_string_ex(pvalue); ++ CHECK_HEADER_INJECTION(Z_STRVAL_PP(pvalue), 0, "body md5"); + bod->md5 = cpystr(Z_STRVAL_PP(pvalue)); + } + } +@@ -3710,6 +3754,7 @@ + } + if (zend_hash_find(Z_ARRVAL_PP(data), "charset", sizeof("charset"), (void **) &pvalue)== SUCCESS) { + convert_to_string_ex(pvalue); ++ CHECK_HEADER_INJECTION(Z_STRVAL_PP(pvalue), 0, "body charset"); + tmp_param = mail_newbody_parameter(); + tmp_param->value = (char *) fs_get(Z_STRLEN_PP(pvalue) + 1); + memcpy(tmp_param->value, Z_STRVAL_PP(pvalue), Z_STRLEN_PP(pvalue) + 1); +@@ -3723,8 +3768,10 @@ + while (zend_hash_get_current_data(Z_ARRVAL_PP(pvalue), (void **) &disp_data) == SUCCESS) { + disp_param = mail_newbody_parameter(); + zend_hash_get_current_key(Z_ARRVAL_PP(pvalue), &key, &ind, 0); ++ CHECK_HEADER_INJECTION(key, 0, "body type.parameters key"); + disp_param->attribute = cpystr(key); + convert_to_string_ex(disp_data); ++ CHECK_HEADER_INJECTION(Z_STRVAL_PP(disp_data), 0, "body type.parameters value"); + disp_param->value = (char *) fs_get(Z_STRLEN_PP(disp_data) + 1); + memcpy(disp_param->value, Z_STRVAL_PP(disp_data), Z_STRLEN_PP(disp_data) + 1); + zend_hash_move_forward(Z_ARRVAL_PP(pvalue)); +@@ -3736,18 +3783,22 @@ + } + if (zend_hash_find(Z_ARRVAL_PP(data), "subtype", sizeof("subtype"), (void **) &pvalue)== SUCCESS) { + convert_to_string_ex(pvalue); ++ CHECK_HEADER_INJECTION(Z_STRVAL_PP(pvalue), 0, "body subtype"); + bod->subtype = cpystr(Z_STRVAL_PP(pvalue)); + } + if (zend_hash_find(Z_ARRVAL_PP(data), "id", sizeof("id"), (void **) &pvalue)== SUCCESS) { + convert_to_string_ex(pvalue); ++ CHECK_HEADER_INJECTION(Z_STRVAL_PP(pvalue), 0, "body id"); + bod->id = cpystr(Z_STRVAL_PP(pvalue)); + } + if (zend_hash_find(Z_ARRVAL_PP(data), "description", sizeof("description"), (void **) &pvalue)== SUCCESS) { + convert_to_string_ex(pvalue); ++ CHECK_HEADER_INJECTION(Z_STRVAL_PP(pvalue), 0, "body description"); + bod->description = cpystr(Z_STRVAL_PP(pvalue)); + } + if (zend_hash_find(Z_ARRVAL_PP(data), "disposition.type", sizeof("disposition.type"), (void **) &pvalue)== SUCCESS) { + convert_to_string_ex(pvalue); ++ CHECK_HEADER_INJECTION(Z_STRVAL_PP(pvalue), 0, "body disposition.type"); + bod->disposition.type = (char *) fs_get(Z_STRLEN_PP(pvalue) + 1); + memcpy(bod->disposition.type, Z_STRVAL_PP(pvalue), Z_STRLEN_PP(pvalue)+1); + } +@@ -3757,8 +3808,10 @@ + while (zend_hash_get_current_data(Z_ARRVAL_PP(pvalue), (void **) &disp_data) == SUCCESS) { + disp_param = mail_newbody_parameter(); + zend_hash_get_current_key(Z_ARRVAL_PP(pvalue), &key, &ind, 0); ++ CHECK_HEADER_INJECTION(key, 0, "body disposition key"); + disp_param->attribute = cpystr(key); + convert_to_string_ex(disp_data); ++ CHECK_HEADER_INJECTION(Z_STRVAL_PP(disp_data), 0, "body disposition value"); + disp_param->value = (char *) fs_get(Z_STRLEN_PP(disp_data) + 1); + memcpy(disp_param->value, Z_STRVAL_PP(disp_data), Z_STRLEN_PP(disp_data) + 1); + zend_hash_move_forward(Z_ARRVAL_PP(pvalue)); +@@ -3788,6 +3841,7 @@ + } + if (zend_hash_find(Z_ARRVAL_PP(data), "md5", sizeof("md5"), (void **) &pvalue)== SUCCESS) { + convert_to_string_ex(pvalue); ++ CHECK_HEADER_INJECTION(Z_STRVAL_PP(pvalue), 0, "body md5"); + bod->md5 = cpystr(Z_STRVAL_PP(pvalue)); + } + } +--- /dev/null ++++ b/ext/imap/tests/bug80710_1.phpt +@@ -0,0 +1,37 @@ ++--TEST-- ++Bug #80710 (imap_mail_compose() header injection) - MIME Splitting Attack ++--SKIPIF-- ++<?php ++if (!extension_loaded("imap")) die("skip imap extension not available"); ++?> ++--FILE-- ++<?php ++$envelope["from"]= "joe@example.com\n From : X-INJECTED"; ++$envelope["to"] = "foo@example.com\nFrom: X-INJECTED"; ++$envelope["cc"] = "bar@example.com\nFrom: X-INJECTED"; ++$envelope["subject"] = "bar@example.com\n\n From : X-INJECTED"; ++$envelope["x-remail"] = "bar@example.com\nFrom: X-INJECTED"; ++$envelope["something"] = "bar@example.com\nFrom: X-INJECTED"; ++ ++$part1["type"] = TYPEMULTIPART; ++$part1["subtype"] = "mixed"; ++ ++$part2["type"] = TYPEAPPLICATION; ++$part2["encoding"] = ENCBINARY; ++$part2["subtype"] = "octet-stream\nContent-Type: X-INJECTED"; ++$part2["description"] = "some file\nContent-Type: X-INJECTED"; ++$part2["contents.data"] = "ABC\nContent-Type: X-INJECTED"; ++ ++$part3["type"] = TYPETEXT; ++$part3["subtype"] = "plain"; ++$part3["description"] = "description3"; ++$part3["contents.data"] = "contents.data3\n\n\n\t"; ++ ++$body[1] = $part1; ++$body[2] = $part2; ++$body[3] = $part3; ++ ++echo imap_mail_compose($envelope, $body); ++?> ++--EXPECTF-- ++Warning: imap_mail_compose(): header injection attempt in from in %s on line %d +--- /dev/null ++++ b/ext/imap/tests/bug80710_2.phpt +@@ -0,0 +1,37 @@ ++--TEST-- ++Bug #80710 (imap_mail_compose() header injection) - Remail ++--SKIPIF-- ++<?php ++if (!extension_loaded("imap")) die("skip imap extension not available"); ++?> ++--FILE-- ++<?php ++$envelope["from"]= "joe@example.com\n From : X-INJECTED"; ++$envelope["to"] = "foo@example.com\nFrom: X-INJECTED"; ++$envelope["cc"] = "bar@example.com\nFrom: X-INJECTED"; ++$envelope["subject"] = "bar@example.com\n\n From : X-INJECTED"; ++$envelope["remail"] = "X-INJECTED-REMAIL: X-INJECTED\nFrom: X-INJECTED-REMAIL-FROM"; //<--- Injected as first hdr ++$envelope["something"] = "bar@example.com\nFrom: X-INJECTED"; ++ ++$part1["type"] = TYPEMULTIPART; ++$part1["subtype"] = "mixed"; ++ ++$part2["type"] = TYPEAPPLICATION; ++$part2["encoding"] = ENCBINARY; ++$part2["subtype"] = "octet-stream\nContent-Type: X-INJECTED"; ++$part2["description"] = "some file\nContent-Type: X-INJECTED"; ++$part2["contents.data"] = "ABC\nContent-Type: X-INJECTED"; ++ ++$part3["type"] = TYPETEXT; ++$part3["subtype"] = "plain"; ++$part3["description"] = "description3"; ++$part3["contents.data"] = "contents.data3\n\n\n\t"; ++ ++$body[1] = $part1; ++$body[2] = $part2; ++$body[3] = $part3; ++ ++echo imap_mail_compose($envelope, $body); ++?> ++--EXPECTF-- ++Warning: imap_mail_compose(): header injection attempt in remail in %s on line %d +diff --git a/ext/interbase/config.m4 b/ext/interbase/config.m4 +index 6aa1b36..8bb4c2e 100644 +--- a/ext/interbase/config.m4 ++++ b/ext/interbase/config.m4 +@@ -3,39 +3,54 @@ + install directory [/usr/interbase]]) + + if test "$PHP_INTERBASE" != "no"; then +- if test "$PHP_INTERBASE" = "yes"; then +- IBASE_INCDIR=/usr/interbase/include +- IBASE_LIBDIR=/usr/interbase/lib ++ ++ AC_PATH_PROG(FB_CONFIG, fb_config, no) ++ ++ if test -x "$FB_CONFIG" && test "$PHP_INTERBASE" = "yes"; then ++ AC_MSG_CHECKING(for libfbconfig) ++ FB_CFLAGS=`$FB_CONFIG --cflags` ++ FB_LIBDIR=`$FB_CONFIG --libs` ++ FB_VERSION=`$FB_CONFIG --version` ++ AC_MSG_RESULT(version $FB_VERSION) ++ PHP_EVAL_LIBLINE($FB_LIBDIR, INTERBASE_SHARED_LIBADD) ++ PHP_EVAL_INCLINE($FB_CFLAGS) ++ + else +- IBASE_INCDIR=$PHP_INTERBASE/include +- IBASE_LIBDIR=$PHP_INTERBASE/$PHP_LIBDIR +- fi ++ if test "$PHP_INTERBASE" = "yes"; then ++ IBASE_INCDIR=/usr/interbase/include ++ IBASE_LIBDIR=/usr/interbase/lib ++ else ++ IBASE_INCDIR=$PHP_INTERBASE/include ++ IBASE_LIBDIR=$PHP_INTERBASE/$PHP_LIBDIR ++ fi + +- PHP_CHECK_LIBRARY(fbclient, isc_detach_database, +- [ +- IBASE_LIBNAME=fbclient +- ], [ +- PHP_CHECK_LIBRARY(gds, isc_detach_database, ++ PHP_CHECK_LIBRARY(fbclient, isc_detach_database, + [ +- IBASE_LIBNAME=gds ++ IBASE_LIBNAME=fbclient + ], [ +- PHP_CHECK_LIBRARY(ib_util, isc_detach_database, ++ PHP_CHECK_LIBRARY(gds, isc_detach_database, + [ +- IBASE_LIBNAME=ib_util ++ IBASE_LIBNAME=gds + ], [ +- AC_MSG_ERROR([libgds, libib_util or libfbclient not found! Check config.log for more information.]) ++ PHP_CHECK_LIBRARY(ib_util, isc_detach_database, ++ [ ++ IBASE_LIBNAME=ib_util ++ ], [ ++ AC_MSG_ERROR([libgds, libib_util or libfbclient not found! Check config.log for more information.]) ++ ], [ ++ -L$IBASE_LIBDIR ++ ]) + ], [ + -L$IBASE_LIBDIR + ]) + ], [ + -L$IBASE_LIBDIR + ]) +- ], [ +- -L$IBASE_LIBDIR +- ]) + +- PHP_ADD_LIBRARY_WITH_PATH($IBASE_LIBNAME, $IBASE_LIBDIR, INTERBASE_SHARED_LIBADD) +- PHP_ADD_INCLUDE($IBASE_INCDIR) ++ PHP_ADD_LIBRARY_WITH_PATH($IBASE_LIBNAME, $IBASE_LIBDIR, INTERBASE_SHARED_LIBADD) ++ PHP_ADD_INCLUDE($IBASE_INCDIR) ++ fi ++ + AC_DEFINE(HAVE_IBASE,1,[ ]) + PHP_NEW_EXTENSION(interbase, interbase.c ibase_query.c ibase_service.c ibase_events.c ibase_blobs.c, $ext_shared) + PHP_SUBST(INTERBASE_SHARED_LIBADD) +diff --git a/ext/pdo_firebird/config.m4 b/ext/pdo_firebird/config.m4 +index f9188a0..e6362cd 100644 +--- a/ext/pdo_firebird/config.m4 ++++ b/ext/pdo_firebird/config.m4 +@@ -8,43 +8,56 @@ + AC_MSG_ERROR([PDO is not enabled! Add --enable-pdo to your configure line.]) + fi + +- if test "$PHP_PDO_FIREBIRD" = "yes"; then +- FIREBIRD_INCDIR= +- FIREBIRD_LIBDIR= +- FIREBIRD_LIBDIR_FLAG= ++ AC_PATH_PROG(FB_CONFIG, fb_config, no) ++ ++ if test -x "$FB_CONFIG" && test "$PHP_PDO_FIREBIRD" = "yes"; then ++ AC_MSG_CHECKING(for libfbconfig) ++ FB_CFLAGS=`$FB_CONFIG --cflags` ++ FB_LIBDIR=`$FB_CONFIG --libs` ++ FB_VERSION=`$FB_CONFIG --version` ++ AC_MSG_RESULT(version $FB_VERSION) ++ PHP_EVAL_LIBLINE($FB_LIBDIR, PDO_FIREBIRD_SHARED_LIBADD) ++ PHP_EVAL_INCLINE($FB_CFLAGS) ++ + else +- FIREBIRD_INCDIR=$PHP_PDO_FIREBIRD/include +- FIREBIRD_LIBDIR=$PHP_PDO_FIREBIRD/$PHP_LIBDIR +- FIREBIRD_LIBDIR_FLAG=-L$FIREBIRD_LIBDIR +- fi ++ if test "$PHP_PDO_FIREBIRD" = "yes"; then ++ FIREBIRD_INCDIR= ++ FIREBIRD_LIBDIR= ++ FIREBIRD_LIBDIR_FLAG= ++ else ++ FIREBIRD_INCDIR=$PHP_PDO_FIREBIRD/include ++ FIREBIRD_LIBDIR=$PHP_PDO_FIREBIRD/$PHP_LIBDIR ++ FIREBIRD_LIBDIR_FLAG=-L$FIREBIRD_LIBDIR ++ fi + +- PHP_CHECK_LIBRARY(fbclient, isc_detach_database, +- [ +- FIREBIRD_LIBNAME=fbclient +- ], [ +- PHP_CHECK_LIBRARY(gds, isc_detach_database, ++ PHP_CHECK_LIBRARY(fbclient, isc_detach_database, + [ +- FIREBIRD_LIBNAME=gds ++ FIREBIRD_LIBNAME=fbclient + ], [ +- PHP_CHECK_LIBRARY(ib_util, isc_detach_database, ++ PHP_CHECK_LIBRARY(gds, isc_detach_database, + [ +- FIREBIRD_LIBNAME=ib_util ++ FIREBIRD_LIBNAME=gds + ], [ +- AC_MSG_ERROR([libfbclient, libgds or libib_util not found! Check config.log for more information.]) ++ PHP_CHECK_LIBRARY(ib_util, isc_detach_database, ++ [ ++ FIREBIRD_LIBNAME=ib_util ++ ], [ ++ AC_MSG_ERROR([libfbclient, libgds or libib_util not found! Check config.log for more information.]) ++ ], [ ++ $FIREBIRD_LIBDIR_FLAG ++ ]) + ], [ + $FIREBIRD_LIBDIR_FLAG + ]) + ], [ + $FIREBIRD_LIBDIR_FLAG + ]) +- ], [ +- $FIREBIRD_LIBDIR_FLAG +- ]) ++ PHP_ADD_LIBRARY_WITH_PATH($FIREBIRD_LIBNAME, $FIREBIRD_LIBDIR, PDO_FIREBIRD_SHARED_LIBADD) ++ PHP_ADD_INCLUDE($FIREBIRD_INCDIR) ++ fi + + PHP_CHECK_PDO_INCLUDES + +- PHP_ADD_LIBRARY_WITH_PATH($FIREBIRD_LIBNAME, $FIREBIRD_LIBDIR, PDO_FIREBIRD_SHARED_LIBADD) +- PHP_ADD_INCLUDE($FIREBIRD_INCDIR) + AC_DEFINE(HAVE_PDO_FIREBIRD,1,[ ]) + PHP_NEW_EXTENSION(pdo_firebird, pdo_firebird.c firebird_driver.c firebird_statement.c, $ext_shared,,-I$pdo_cv_inc_path) + PHP_SUBST(PDO_FIREBIRD_SHARED_LIBADD) +diff --git a/ext/pdo_firebird/firebird_statement.c b/ext/pdo_firebird/firebird_statement.c +index d1f1012..8b8f822 100644 +--- a/ext/pdo_firebird/firebird_statement.c ++++ b/ext/pdo_firebird/firebird_statement.c +@@ -267,8 +267,8 @@ + unsigned short seg_len; + ISC_STATUS stat; + +- *ptr = S->fetch_buf[colno] = erealloc(*ptr, *len+1); +- ++ *ptr = S->fetch_buf[colno] = erealloc(S->fetch_buf[colno], *len+1); ++ + for (cur_len = stat = 0; (!stat || stat == isc_segment) && cur_len < *len; cur_len += seg_len) { + + unsigned short chunk_size = (*len-cur_len) > USHRT_MAX ? USHRT_MAX +--- /dev/null ++++ b/ext/pdo_firebird/tests/bug_76488.phpt +@@ -0,0 +1,32 @@ ++--TEST-- ++PDO_Firebird: Bug #76488 Memory leak when fetching a BLOB field ++--SKIPIF-- ++<?php if (!extension_loaded('interbase') || !extension_loaded('pdo_firebird')) die('skip'); ?> ++--FILE-- ++<?php ++require 'testdb.inc'; ++$dbh = new PDO('firebird:dbname='.$test_base, $user, $password) or die; ++ ++$sql = ' ++with recursive r(n) as ( ++ select 1 from rdb$database ++ union all ++ select n+1 from r where n < 1000 ++) ++select n, ++ cast(lpad(\'A\', 8000, \'A\') as BLOB sub_type TEXT) as SRC ++from r ++'; ++ ++ for ($i = 0; $i < 10; $i++) { ++ $sth = $dbh->prepare($sql); ++ $sth->execute(); ++ $rows = $sth->fetchAll(); ++ unset($rows); ++ unset($sth); ++ } ++ unset($dbh); ++ echo "OK"; ++?> ++--EXPECT-- ++OK +\ No newline at end of file +diff --git a/ext/pdo_firebird/firebird_statement.c b/ext/pdo_firebird/firebird_statement.c +index cb7e4bd..a87bcc1 100644 +--- a/ext/pdo_firebird/firebird_statement.c ++++ b/ext/pdo_firebird/firebird_statement.c +@@ -120,8 +120,14 @@ + } + if (result[0] == isc_info_sql_records) { + unsigned i = 3, result_size = isc_vax_integer(&result[1], 2); ++ if (result_size > sizeof(result)) { ++ goto error; ++ } + while (result[i] != isc_info_end && i < result_size) { + short len = (short) isc_vax_integer(&result[i + 1], 2); ++ if (len != 1 && len != 2 && len != 4) { ++ goto error; ++ } + if (result[i] != isc_info_req_select_count) { + affected_rows += isc_vax_integer(&result[i + 3], len); + } +@@ -145,7 +151,8 @@ + return 1; + } while (0); + +- RECORD_ERROR(stmt); ++error: ++ RECORD_ERROR(stmt); + + return 0; + } +--- /dev/null ++++ b/ext/pdo_firebird/tests/bug_76450.data +@@ -0,0 +1 @@ ++ +\ No newline at end of file +--- /dev/null ++++ b/ext/pdo_firebird/tests/bug_76450.phpt +@@ -0,0 +1,29 @@ ++--TEST-- ++Bug #76450 (SIGSEGV in firebird_stmt_execute) ++--SKIPIF-- ++<?php ++if (!extension_loaded('pdo_firebird')) die("skip pdo_firebird extension not available"); ++if (!extension_loaded('sockets')) die("skip sockets extension not available"); ++?> ++--FILE-- ++<?php ++require_once "payload_server.inc"; ++ ++$address = run_server(__DIR__ . "/bug_76450.data"); ++ ++// no need to change the credentials; we're running against a fake server ++$dsn = "firebird:dbname=inet://$address/test"; ++$username = 'SYSDBA'; ++$password = 'masterkey'; ++ ++$dbh = new PDO($dsn, $username, $password, [PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION]); ++$sql = "EXECUTE PROCEDURE test_proc 123"; ++$query = $dbh->prepare($sql); ++try { ++ $query->execute(); ++} catch (Exception $ex) { ++ echo "{$ex->getMessage()}\n"; ++} ++?> ++--EXPECT-- ++SQLSTATE[HY000]: General error +diff --git a/ext/pdo_firebird/firebird_driver.c b/ext/pdo_firebird/firebird_driver.c +index 2e71d9d..baa1b96 100644 +--- a/ext/pdo_firebird/firebird_driver.c ++++ b/ext/pdo_firebird/firebird_driver.c +@@ -252,8 +252,17 @@ + if (result[0] == isc_info_sql_records) { + unsigned i = 3, result_size = isc_vax_integer(&result[1],2); + ++ if (result_size > sizeof(result)) { ++ ret = -1; ++ goto free_statement; ++ } + while (result[i] != isc_info_end && i < result_size) { + short len = (short)isc_vax_integer(&result[i+1],2); ++ /* bail out on bad len */ ++ if (len != 1 && len != 2 && len != 4) { ++ ret = -1; ++ goto free_statement; ++ } + if (result[i] != isc_info_req_select_count) { + ret += isc_vax_integer(&result[i+3],len); + } +--- /dev/null ++++ b/ext/pdo_firebird/tests/bug_76449.data +@@ -0,0 +1 @@ ++ +\ No newline at end of file +--- /dev/null ++++ b/ext/pdo_firebird/tests/bug_76449.phpt +@@ -0,0 +1,23 @@ ++--TEST-- ++Bug #76449 (SIGSEGV in firebird_handle_doer) ++--SKIPIF-- ++<?php ++if (!extension_loaded('pdo_firebird')) die("skip pdo_firebird extension not available"); ++if (!extension_loaded('sockets')) die("skip sockets extension not available"); ++?> ++--FILE-- ++<?php ++require_once "payload_server.inc"; ++ ++$address = run_server(__DIR__ . "/bug_76449.data"); ++ ++// no need to change the credentials; we're running against a fake server ++$dsn = "firebird:dbname=inet://$address/test"; ++$username = 'SYSDBA'; ++$password = 'masterkey'; ++ ++$dbh = new PDO($dsn, $username, $password, [PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION]); ++var_dump($dbh->exec("INSERT INTO test VALUES ('hihi2', 'xxxxx')")); ++?> ++--EXPECT-- ++bool(false) +diff --git a/ext/pdo_firebird/firebird_driver.c b/ext/pdo_firebird/firebird_driver.c +index baa1b96..23bf8d8 100644 +--- a/ext/pdo_firebird/firebird_driver.c ++++ b/ext/pdo_firebird/firebird_driver.c +@@ -539,14 +539,16 @@ + } + /* }}} */ + ++#define INFO_BUF_LEN 512 ++ + /* callback to used to report database server info */ + static void firebird_info_cb(void *arg, char const *s) /* {{{ */ + { + if (arg) { + if (*(char*)arg) { /* second call */ +- strcat(arg, " "); ++ strlcat(arg, " ", INFO_BUF_LEN); + } +- strcat(arg, s); ++ strlcat(arg, s, INFO_BUF_LEN); + } + } + /* }}} */ +@@ -557,8 +559,8 @@ + pdo_firebird_db_handle *H = (pdo_firebird_db_handle *)dbh->driver_data; + + switch (attr) { +- char tmp[512]; +- ++ char tmp[INFO_BUF_LEN]; ++ + case PDO_ATTR_AUTOCOMMIT: + ZVAL_LONG(val,dbh->auto_commit); + return 1; +--- /dev/null ++++ b/ext/pdo_firebird/tests/bug_76448.data +@@ -0,0 +1 @@ ++ +\ No newline at end of file +--- /dev/null ++++ b/ext/pdo_firebird/tests/bug_76448.phpt +@@ -0,0 +1,23 @@ ++--TEST-- ++Bug #76448 (Stack buffer overflow in firebird_info_cb) ++--SKIPIF-- ++<?php ++if (!extension_loaded('pdo_firebird')) die("skip podo_firebird extension not available"); ++if (!extension_loaded('sockets')) die("skip sockets extension not available"); ++?> ++--FILE-- ++<?php ++require_once "payload_server.inc"; ++ ++$address = run_server(__DIR__ . "/bug_76448.data"); ++ ++// no need to change the credentials; we're running against a falke server ++$dsn = "firebird:dbname=inet://$address/test"; ++$username = 'SYSDBA'; ++$password = 'masterkey'; ++ ++$dbh = new PDO($dsn, $username, $password, [PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION]); ++var_dump($dbh->getAttribute(PDO::ATTR_SERVER_INFO)); ++?> ++--EXPECT-- ++bool(false) +diff --git a/ext/pdo_firebird/firebird_driver.c b/ext/pdo_firebird/firebird_driver.c +index 23bf8d8..f8a44e7 100644 +--- a/ext/pdo_firebird/firebird_driver.c ++++ b/ext/pdo_firebird/firebird_driver.c +@@ -239,14 +239,16 @@ + /* execute the statement */ + if (isc_dsql_execute2(H->isc_status, &H->tr, &stmt, PDO_FB_SQLDA_VERSION, &in_sqlda, &out_sqlda)) { + RECORD_ERROR(dbh); +- return -1; ++ ret = -1; ++ goto free_statement; + } + + /* find out how many rows were affected */ + if (isc_dsql_sql_info(H->isc_status, &stmt, sizeof(info_count), const_cast(info_count), + sizeof(result), result)) { + RECORD_ERROR(dbh); +- return -1; ++ ret = -1; ++ goto free_statement; + } + + if (result[0] == isc_info_sql_records) { +@@ -275,6 +277,12 @@ + RECORD_ERROR(dbh); + } + ++free_statement: ++ ++ if (isc_dsql_free_statement(H->isc_status, &stmt, DSQL_drop)) { ++ RECORD_ERROR(dbh); ++ } ++ + return ret; + } + /* }}} */ +diff --git a/ext/pdo_firebird/firebird_driver.c b/ext/pdo_firebird/firebird_driver.c +index f8a44e7..c53fd31 100644 +--- a/ext/pdo_firebird/firebird_driver.c ++++ b/ext/pdo_firebird/firebird_driver.c +@@ -139,7 +139,7 @@ + HashTable *np; + + do { +- isc_stmt_handle s = NULL; ++ isc_stmt_handle s = PDO_FIREBIRD_HANDLE_INITIALIZER; + XSQLDA num_sqlda; + static char const info[] = { isc_info_sql_stmt_type }; + char result[8]; +@@ -220,7 +220,7 @@ + static long firebird_handle_doer(pdo_dbh_t *dbh, const char *sql, long sql_len TSRMLS_DC) /* {{{ */ + { + pdo_firebird_db_handle *H = (pdo_firebird_db_handle *)dbh->driver_data; +- isc_stmt_handle stmt = NULL; ++ isc_stmt_handle stmt = PDO_FIREBIRD_HANDLE_INITIALIZER; + static char const info_count[] = { isc_info_sql_records }; + char result[64]; + int ret = 0; +diff --git a/ext/pdo_firebird/firebird_statement.c b/ext/pdo_firebird/firebird_statement.c +index a87bcc1..dc64c19 100644 +--- a/ext/pdo_firebird/firebird_statement.c ++++ b/ext/pdo_firebird/firebird_statement.c +@@ -230,7 +230,7 @@ + { + pdo_firebird_stmt *S = (pdo_firebird_stmt*)stmt->driver_data; + pdo_firebird_db_handle *H = S->H; +- isc_blob_handle blobh = NULL; ++ isc_blob_handle blobh = PDO_FIREBIRD_HANDLE_INITIALIZER; + char const bl_item = isc_info_blob_total_length; + char bl_info[20]; + unsigned short i; +@@ -424,7 +424,7 @@ + { + pdo_firebird_stmt *S = (pdo_firebird_stmt*)stmt->driver_data; + pdo_firebird_db_handle *H = S->H; +- isc_blob_handle h = NULL; ++ isc_blob_handle h = PDO_FIREBIRD_HANDLE_INITIALIZER; + unsigned long put_cnt = 0, rem_cnt; + unsigned short chunk_size; + int result = 1; +diff --git a/ext/pdo_firebird/php_pdo_firebird_int.h b/ext/pdo_firebird/php_pdo_firebird_int.h +index 796f383..09cd485 100644 +--- a/ext/pdo_firebird/php_pdo_firebird_int.h ++++ b/ext/pdo_firebird/php_pdo_firebird_int.h +@@ -61,6 +61,12 @@ + #define min(a,b) ((a)<(b)?(a):(b)) + #endif + ++#if defined(_LP64) || defined(__LP64__) || defined(__arch64__) || defined(_WIN64) ++# define PDO_FIREBIRD_HANDLE_INITIALIZER 0U ++#else ++# define PDO_FIREBIRD_HANDLE_INITIALIZER NULL ++#endif ++ + typedef struct { + + /* the result of the last API call */ +diff --git a/sapi/fpm/fpm/fpm_children.c b/sapi/fpm/fpm/fpm_children.c +index 45cc075..74c2f38 100644 +--- a/sapi/fpm/fpm/fpm_children.c ++++ b/sapi/fpm/fpm/fpm_children.c +@@ -239,7 +239,7 @@ + + fpm_child_unlink(child); + +- fpm_scoreboard_proc_free(wp->scoreboard, child->scoreboard_i); ++ fpm_scoreboard_proc_free(child); + + fpm_clock_get(&tv1); + +@@ -249,9 +249,9 @@ + if (!fpm_pctl_can_spawn_children()) { + severity = ZLOG_DEBUG; + } +- zlog(severity, "[pool %s] child %d exited %s after %ld.%06d seconds from start", child->wp->config->name, (int) pid, buf, tv2.tv_sec, (int) tv2.tv_usec); ++ zlog(severity, "[pool %s] child %d exited %s after %ld.%06d seconds from start", wp->config->name, (int) pid, buf, tv2.tv_sec, (int) tv2.tv_usec); + } else { +- zlog(ZLOG_DEBUG, "[pool %s] child %d has been killed by the process management after %ld.%06d seconds from start", child->wp->config->name, (int) pid, tv2.tv_sec, (int) tv2.tv_usec); ++ zlog(ZLOG_DEBUG, "[pool %s] child %d has been killed by the process management after %ld.%06d seconds from start", wp->config->name, (int) pid, tv2.tv_sec, (int) tv2.tv_usec); + } + + fpm_child_close(child, 1 /* in event_loop */); +@@ -317,7 +317,7 @@ + return 0; + } + +- if (0 > fpm_scoreboard_proc_alloc(wp->scoreboard, &c->scoreboard_i)) { ++ if (0 > fpm_scoreboard_proc_alloc(c)) { + fpm_stdio_discard_pipes(c); + fpm_child_free(c); + return 0; +@@ -329,7 +329,7 @@ + + static void fpm_resources_discard(struct fpm_child_s *child) /* {{{ */ + { +- fpm_scoreboard_proc_free(child->wp->scoreboard, child->scoreboard_i); ++ fpm_scoreboard_proc_free(child); + fpm_stdio_discard_pipes(child); + fpm_child_free(child); + } +@@ -342,10 +342,10 @@ + if (wp == child->wp) { + continue; + } +- fpm_scoreboard_free(wp->scoreboard); ++ fpm_scoreboard_free(wp); + } + +- fpm_scoreboard_child_use(child->wp->scoreboard, child->scoreboard_i, getpid()); ++ fpm_scoreboard_child_use(child, getpid()); + fpm_stdio_child_use_pipes(child); + fpm_child_free(child); + } +diff --git a/sapi/fpm/fpm/fpm_request.c b/sapi/fpm/fpm/fpm_request.c +index ed7e7a8..23782fb 100644 +--- a/sapi/fpm/fpm/fpm_request.c ++++ b/sapi/fpm/fpm/fpm_request.c +@@ -287,7 +287,7 @@ + struct fpm_scoreboard_proc_s *proc; + + /* no need in atomicity here */ +- proc = fpm_scoreboard_proc_get(child->wp->scoreboard, child->scoreboard_i); ++ proc = fpm_scoreboard_proc_get_from_child(child); + if (!proc) { + return 0; + } +@@ -302,7 +302,7 @@ + + if (!tv) return -1; + +- proc = fpm_scoreboard_proc_get(child->wp->scoreboard, child->scoreboard_i); ++ proc = fpm_scoreboard_proc_get_from_child(child); + if (!proc) { + return -1; + } +diff --git a/sapi/fpm/fpm/fpm_scoreboard.c b/sapi/fpm/fpm/fpm_scoreboard.c +index e1e69c9..fcf9f16 100644 +--- a/sapi/fpm/fpm/fpm_scoreboard.c ++++ b/sapi/fpm/fpm/fpm_scoreboard.c +@@ -8,6 +8,7 @@ + #include <time.h> + + #include "fpm_config.h" ++#include "fpm_children.h" + #include "fpm_scoreboard.h" + #include "fpm_shm.h" + #include "fpm_sockets.h" +@@ -25,7 +26,6 @@ + int fpm_scoreboard_init_main() /* {{{ */ + { + struct fpm_worker_pool_s *wp; +- unsigned int i; + + #ifdef HAVE_TIMES + #if (defined(HAVE_SYSCONF) && defined(_SC_CLK_TCK)) +@@ -42,7 +42,7 @@ + + + for (wp = fpm_worker_all_pools; wp; wp = wp->next) { +- size_t scoreboard_size, scoreboard_nprocs_size; ++ size_t scoreboard_procs_size; + void *shm_mem; + + if (wp->config->pm_max_children < 1) { +@@ -55,22 +55,15 @@ + return -1; + } + +- scoreboard_size = sizeof(struct fpm_scoreboard_s) + (wp->config->pm_max_children) * sizeof(struct fpm_scoreboard_proc_s *); +- scoreboard_nprocs_size = sizeof(struct fpm_scoreboard_proc_s) * wp->config->pm_max_children; +- shm_mem = fpm_shm_alloc(scoreboard_size + scoreboard_nprocs_size); ++ scoreboard_procs_size = sizeof(struct fpm_scoreboard_proc_s) * wp->config->pm_max_children; ++ shm_mem = fpm_shm_alloc(sizeof(struct fpm_scoreboard_s) + scoreboard_procs_size); + + if (!shm_mem) { + return -1; + } +- wp->scoreboard = shm_mem; ++ wp->scoreboard = shm_mem; ++ wp->scoreboard->pm = wp->config->pm; + wp->scoreboard->nprocs = wp->config->pm_max_children; +- shm_mem += scoreboard_size; +- +- for (i = 0; i < wp->scoreboard->nprocs; i++, shm_mem += sizeof(struct fpm_scoreboard_proc_s)) { +- wp->scoreboard->procs[i] = shm_mem; +- } +- +- wp->scoreboard->pm = wp->config->pm; + wp->scoreboard->start_epoch = time(NULL); + strlcpy(wp->scoreboard->pool, wp->config->name, sizeof(wp->scoreboard->pool)); + } +@@ -164,28 +157,47 @@ + } + /* }}} */ + +-struct fpm_scoreboard_proc_s *fpm_scoreboard_proc_get(struct fpm_scoreboard_s *scoreboard, int child_index) /* {{{*/ ++static inline struct fpm_scoreboard_proc_s *fpm_scoreboard_proc_get_ex( ++ struct fpm_scoreboard_s *scoreboard, int child_index, unsigned int nprocs) /* {{{*/ + { + if (!scoreboard) { +- scoreboard = fpm_scoreboard; ++ return NULL; + } + +- if (!scoreboard) { ++ if (child_index < 0 || (unsigned int)child_index >= nprocs) { + return NULL; + } + ++ return &scoreboard->procs[child_index]; ++} ++/* }}} */ ++ ++struct fpm_scoreboard_proc_s *fpm_scoreboard_proc_get( ++ struct fpm_scoreboard_s *scoreboard, int child_index) /* {{{*/ ++{ ++ if (!scoreboard) { ++ scoreboard = fpm_scoreboard; ++ } ++ + if (child_index < 0) { + child_index = fpm_scoreboard_i; + } + +- if (child_index < 0 || child_index >= scoreboard->nprocs) { +- return NULL; +- } ++ return fpm_scoreboard_proc_get_ex(scoreboard, child_index, scoreboard->nprocs); ++} ++ ++struct fpm_scoreboard_proc_s *fpm_scoreboard_proc_get_from_child(struct fpm_child_s *child) /* {{{*/ ++{ ++ struct fpm_worker_pool_s *wp = child->wp; ++ unsigned int nprocs = wp->config->pm_max_children; ++ struct fpm_scoreboard_s *scoreboard = wp->scoreboard; ++ int child_index = child->scoreboard_i; + +- return scoreboard->procs[child_index]; ++ return fpm_scoreboard_proc_get_ex(scoreboard, child_index, nprocs); + } + /* }}} */ + ++ + struct fpm_scoreboard_s *fpm_scoreboard_acquire(struct fpm_scoreboard_s *scoreboard, int nohang) /* {{{ */ + { + struct fpm_scoreboard_s *s; +@@ -236,28 +248,28 @@ + proc->lock = 0; + } + +-void fpm_scoreboard_free(struct fpm_scoreboard_s *scoreboard) /* {{{ */ ++void fpm_scoreboard_free(struct fpm_worker_pool_s *wp) /* {{{ */ + { +- size_t scoreboard_size, scoreboard_nprocs_size; ++ size_t scoreboard_procs_size; ++ struct fpm_scoreboard_s *scoreboard = wp->scoreboard; + + if (!scoreboard) { + zlog(ZLOG_ERROR, "**scoreboard is NULL"); + return; + } + +- scoreboard_size = sizeof(struct fpm_scoreboard_s) + (scoreboard->nprocs) * sizeof(struct fpm_scoreboard_proc_s *); +- scoreboard_nprocs_size = sizeof(struct fpm_scoreboard_proc_s) * scoreboard->nprocs; +- +- fpm_shm_free(scoreboard, scoreboard_size + scoreboard_nprocs_size); ++ scoreboard_procs_size = sizeof(struct fpm_scoreboard_proc_s) * wp->config->pm_max_children; ++ ++ fpm_shm_free(scoreboard, sizeof(struct fpm_scoreboard_s) + scoreboard_procs_size); + } + /* }}} */ + +-void fpm_scoreboard_child_use(struct fpm_scoreboard_s *scoreboard, int child_index, pid_t pid) /* {{{ */ ++void fpm_scoreboard_child_use(struct fpm_child_s *child, pid_t pid) /* {{{ */ + { + struct fpm_scoreboard_proc_s *proc; +- fpm_scoreboard = scoreboard; +- fpm_scoreboard_i = child_index; +- proc = fpm_scoreboard_proc_get(scoreboard, child_index); ++ fpm_scoreboard = child->wp->scoreboard; ++ fpm_scoreboard_i = child->scoreboard_i; ++ proc = fpm_scoreboard_proc_get_from_child(child); + if (!proc) { + return; + } +@@ -266,18 +278,22 @@ + } + /* }}} */ + +-void fpm_scoreboard_proc_free(struct fpm_scoreboard_s *scoreboard, int child_index) /* {{{ */ ++void fpm_scoreboard_proc_free(struct fpm_child_s *child) /* {{{ */ + { ++ struct fpm_worker_pool_s *wp = child->wp; ++ struct fpm_scoreboard_s *scoreboard = wp->scoreboard; ++ int child_index = child->scoreboard_i; ++ + if (!scoreboard) { + return; + } + +- if (child_index < 0 || child_index >= scoreboard->nprocs) { ++ if (child_index < 0 || child_index >= wp->config->pm_max_children) { + return; + } + +- if (scoreboard->procs[child_index] && scoreboard->procs[child_index]->used > 0) { +- memset(scoreboard->procs[child_index], 0, sizeof(struct fpm_scoreboard_proc_s)); ++ if (scoreboard->procs[child_index].used > 0) { ++ memset(&scoreboard->procs[child_index], 0, sizeof(struct fpm_scoreboard_proc_s)); + } + + /* set this slot as free to avoid search on next alloc */ +@@ -285,41 +301,44 @@ + } + /* }}} */ + +-int fpm_scoreboard_proc_alloc(struct fpm_scoreboard_s *scoreboard, int *child_index) /* {{{ */ ++int fpm_scoreboard_proc_alloc(struct fpm_child_s *child) /* {{{ */ + { + int i = -1; ++ struct fpm_worker_pool_s *wp = child->wp; ++ struct fpm_scoreboard_s *scoreboard = wp->scoreboard; ++ int nprocs = wp->config->pm_max_children; + +- if (!scoreboard || !child_index) { ++ if (!scoreboard) { + return -1; + } + + /* first try the slot which is supposed to be free */ +- if (scoreboard->free_proc >= 0 && scoreboard->free_proc < scoreboard->nprocs) { +- if (scoreboard->procs[scoreboard->free_proc] && !scoreboard->procs[scoreboard->free_proc]->used) { ++ if (scoreboard->free_proc >= 0 && scoreboard->free_proc < nprocs) { ++ if (!scoreboard->procs[scoreboard->free_proc].used) { + i = scoreboard->free_proc; + } + } + + if (i < 0) { /* the supposed free slot is not, let's search for a free slot */ + zlog(ZLOG_DEBUG, "[pool %s] the proc->free_slot was not free. Let's search", scoreboard->pool); +- for (i = 0; i < scoreboard->nprocs; i++) { +- if (scoreboard->procs[i] && !scoreboard->procs[i]->used) { /* found */ ++ for (i = 0; i < nprocs; i++) { ++ if (!scoreboard->procs[i].used) { /* found */ + break; + } + } + } + + /* no free slot */ +- if (i < 0 || i >= scoreboard->nprocs) { ++ if (i < 0 || i >= nprocs) { + zlog(ZLOG_ERROR, "[pool %s] no free scoreboard slot", scoreboard->pool); + return -1; + } + +- scoreboard->procs[i]->used = 1; +- *child_index = i; ++ scoreboard->procs[i].used = 1; ++ child->scoreboard_i = i; + + /* supposed next slot is free */ +- if (i + 1 >= scoreboard->nprocs) { ++ if (i + 1 >= nprocs) { + scoreboard->free_proc = 0; + } else { + scoreboard->free_proc = i + 1; +diff --git a/sapi/fpm/fpm/fpm_scoreboard.h b/sapi/fpm/fpm/fpm_scoreboard.h +index f58a287..a0cc093 100644 +--- a/sapi/fpm/fpm/fpm_scoreboard.h ++++ b/sapi/fpm/fpm/fpm_scoreboard.h +@@ -65,7 +65,7 @@ + unsigned int nprocs; + int free_proc; + unsigned long int slow_rq; +- struct fpm_scoreboard_proc_s *procs[]; ++ struct fpm_scoreboard_proc_s procs[]; + }; + + int fpm_scoreboard_init_main(); +@@ -74,18 +74,19 @@ + void fpm_scoreboard_update(int idle, int active, int lq, int lq_len, int requests, int max_children_reached, int slow_rq, int action, struct fpm_scoreboard_s *scoreboard); + struct fpm_scoreboard_s *fpm_scoreboard_get(); + struct fpm_scoreboard_proc_s *fpm_scoreboard_proc_get(struct fpm_scoreboard_s *scoreboard, int child_index); ++struct fpm_scoreboard_proc_s *fpm_scoreboard_proc_get_from_child(struct fpm_child_s *child); + + struct fpm_scoreboard_s *fpm_scoreboard_acquire(struct fpm_scoreboard_s *scoreboard, int nohang); + void fpm_scoreboard_release(struct fpm_scoreboard_s *scoreboard); + struct fpm_scoreboard_proc_s *fpm_scoreboard_proc_acquire(struct fpm_scoreboard_s *scoreboard, int child_index, int nohang); + void fpm_scoreboard_proc_release(struct fpm_scoreboard_proc_s *proc); + +-void fpm_scoreboard_free(struct fpm_scoreboard_s *scoreboard); ++void fpm_scoreboard_free(struct fpm_worker_pool_s *wp); + +-void fpm_scoreboard_child_use(struct fpm_scoreboard_s *scoreboard, int child_index, pid_t pid); ++void fpm_scoreboard_child_use(struct fpm_child_s *child, pid_t pid); + +-void fpm_scoreboard_proc_free(struct fpm_scoreboard_s *scoreboard, int child_index); +-int fpm_scoreboard_proc_alloc(struct fpm_scoreboard_s *scoreboard, int *child_index); ++void fpm_scoreboard_proc_free(struct fpm_child_s *child); ++int fpm_scoreboard_proc_alloc(struct fpm_child_s *child); + + #ifdef HAVE_TIMES + float fpm_scoreboard_get_tick(); +diff --git a/sapi/fpm/fpm/fpm_status.c b/sapi/fpm/fpm/fpm_status.c +index 2363b57..a2ee398 100644 +--- a/sapi/fpm/fpm/fpm_status.c ++++ b/sapi/fpm/fpm/fpm_status.c +@@ -399,10 +399,10 @@ + + first = 1; + for (i=0; i<scoreboard_p->nprocs; i++) { +- if (!scoreboard_p->procs[i] || !scoreboard_p->procs[i]->used) { ++ if (!scoreboard_p->procs[i].used) { + continue; + } +- proc = *scoreboard_p->procs[i]; ++ proc = scoreboard_p->procs[i]; + + if (first) { + first = 0; +diff --git a/sapi/fpm/fpm/fpm_worker_pool.c b/sapi/fpm/fpm/fpm_worker_pool.c +index a002291..c778b33 100644 +--- a/sapi/fpm/fpm/fpm_worker_pool.c ++++ b/sapi/fpm/fpm/fpm_worker_pool.c +@@ -44,7 +44,7 @@ + fpm_worker_pool_config_free(wp->config); + fpm_children_free(wp->children); + if ((which & FPM_CLEANUP_CHILD) == 0 && fpm_globals.parent_pid == getpid()) { +- fpm_scoreboard_free(wp->scoreboard); ++ fpm_scoreboard_free(wp); + } + fpm_worker_pool_free(wp); + } +diff --git a/ext/zip/php_zip.c b/ext/zip/php_zip.c +index 8fa14f3..0768c48 100644 +--- a/ext/zip/php_zip.c ++++ b/ext/zip/php_zip.c +@@ -122,8 +122,8 @@ + return NULL; + } + +- if (IS_SLASH(path[0])) { +- return path + 1; ++ if (IS_ABSOLUTE_PATH(path, path_len)) { ++ return path + COPY_WHEN_ABSOLUTE(path) + 1; + } + + i = path_len; +diff --git a/ext/dom/domimplementation.c b/ext/dom/domimplementation.c +index d79430b..5f2b4e6 100644 +--- a/ext/dom/domimplementation.c ++++ b/ext/dom/domimplementation.c +@@ -111,6 +111,11 @@ + if (systemid_len > 0) + pch2 = systemid; + ++ if (strstr(name, "%00")) { ++ php_error_docref(NULL TSRMLS_CC, E_WARNING, "URI must not contain percent-encoded NUL bytes"); ++ RETURN_FALSE; ++ } ++ + uri = xmlParseURI(name); + if (uri != NULL && uri->opaque != NULL) { + localname = xmlStrdup(uri->opaque); +--- /dev/null ++++ b/ext/dom/tests/bug79971_2.phpt +@@ -0,0 +1,20 @@ ++--TEST-- ++Bug #79971 (special character is breaking the path in xml function) ++--SKIPIF-- ++<?php ++if (!extension_loaded('dom')) die('skip dom extension not available'); ++?> ++--FILE-- ++<?php ++$imp = new DOMImplementation; ++if (PHP_OS_FAMILY === 'Windows') { ++ $path = '/' . str_replace('\\', '/', __DIR__); ++} else { ++ $path = __DIR__; ++} ++$uri = "file://$path/bug79971_2.xml"; ++var_dump($imp->createDocumentType("$uri%00foo")); ++?> ++--EXPECTF-- ++Warning: DOMImplementation::createDocumentType(): URI must not contain percent-encoded NUL bytes in %s on line %d ++bool(false) +diff --git a/ext/libxml/libxml.c b/ext/libxml/libxml.c +index b252cb6..d4a47ff 100644 +--- a/ext/libxml/libxml.c ++++ b/ext/libxml/libxml.c +@@ -301,6 +301,11 @@ + + TSRMLS_FETCH(); + ++ if (strstr(filename, "%00")) { ++ php_error_docref(NULL TSRMLS_CC, E_WARNING, "URI must not contain percent-encoded NUL bytes"); ++ return NULL; ++ } ++ + uri = xmlParseURI(filename); + if (uri && (uri->scheme == NULL || + (xmlStrncmp(BAD_CAST uri->scheme, BAD_CAST "file", 4) == 0))) { +@@ -431,6 +436,11 @@ + if (URI == NULL) + return(NULL); + ++ if (strstr(URI, "%00")) { ++ php_error_docref(NULL TSRMLS_CC, E_WARNING, "URI must not contain percent-encoded NUL bytes"); ++ return NULL; ++ } ++ + puri = xmlParseURI(URI); + if (puri != NULL) { + if (puri->scheme != NULL) +--- /dev/null ++++ b/ext/simplexml/tests/bug79971_1.phpt +@@ -0,0 +1,27 @@ ++--TEST-- ++Bug #79971 (special character is breaking the path in xml function) ++--SKIPIF-- ++<?php ++if (!extension_loaded('simplexml')) die('skip simplexml extension not available'); ++?> ++--FILE-- ++<?php ++if (PHP_OS_FAMILY === 'Windows') { ++ $path = '/' . str_replace('\\', '/', __DIR__); ++} else { ++ $path = __DIR__; ++} ++$uri = "file://$path/bug79971_1.xml"; ++var_dump(simplexml_load_file("$uri%00foo")); ++ ++$sxe = simplexml_load_file($uri); ++var_dump($sxe->asXML("$uri.out%00foo")); ++?> ++--EXPECTF-- ++Warning: simplexml_load_file(): URI must not contain percent-encoded NUL bytes in %s on line %d ++ ++Warning: simplexml_load_file(): I/O warning : failed to load external entity "%s/bug79971_1.xml%00foo" in %s on line %d ++bool(false) ++ ++Warning: SimpleXMLElement::asXML(): URI must not contain percent-encoded NUL bytes in %s on line %d ++bool(false) +--- /dev/null ++++ b/ext/simplexml/tests/bug79971_1.xml +@@ -0,0 +1,2 @@ ++<?xml version="1.0"?> ++<root></root> +diff --git a/ext/libxml/libxml.c b/ext/libxml/libxml.c +index d4a47ff..02453ff 100644 +--- a/ext/libxml/libxml.c ++++ b/ext/libxml/libxml.c +@@ -433,6 +433,8 @@ + void *context = NULL; + char *unescaped = NULL; + ++ TSRMLS_FETCH(); ++ + if (URI == NULL) + return(NULL); + diff --git a/fpm-numeric-uid-gid.patch b/fpm-numeric-uid-gid.patch new file mode 100644 index 000000000000..f99dbe048037 --- /dev/null +++ b/fpm-numeric-uid-gid.patch @@ -0,0 +1,52 @@ +--- a/sapi/fpm/fpm/fpm_unix.c ++++ b/sapi/fpm/fpm/fpm_unix.c +@@ -165,27 +165,35 @@ + #endif + + if (c->listen_owner && *c->listen_owner) { +- struct passwd *pwd; ++ if (strlen(c->listen_owner) == strspn(c->listen_owner, "0123456789")) { ++ wp->socket_uid = strtoul(c->listen_owner, 0, 10); ++ } else { ++ struct passwd *pwd; + +- pwd = getpwnam(c->listen_owner); +- if (!pwd) { +- zlog(ZLOG_SYSERROR, "[pool %s] cannot get uid for user '%s'", wp->config->name, c->listen_owner); +- return -1; +- } ++ pwd = getpwnam(c->listen_owner); ++ if (!pwd) { ++ zlog(ZLOG_SYSERROR, "[pool %s] cannot get uid for user '%s'", wp->config->name, c->listen_owner); ++ return -1; ++ } + +- wp->socket_uid = pwd->pw_uid; +- wp->socket_gid = pwd->pw_gid; ++ wp->socket_uid = pwd->pw_uid; ++ wp->socket_gid = pwd->pw_gid; ++ } + } + + if (c->listen_group && *c->listen_group) { +- struct group *grp; ++ if (strlen(c->listen_group) == strspn(c->listen_group, "0123456789")) { ++ wp->socket_gid = strtoul(c->listen_group, 0, 10); ++ } else { ++ struct group *grp; + +- grp = getgrnam(c->listen_group); +- if (!grp) { +- zlog(ZLOG_SYSERROR, "[pool %s] cannot get gid for group '%s'", wp->config->name, c->listen_group); +- return -1; ++ grp = getgrnam(c->listen_group); ++ if (!grp) { ++ zlog(ZLOG_SYSERROR, "[pool %s] cannot get gid for group '%s'", wp->config->name, c->listen_group); ++ return -1; ++ } ++ wp->socket_gid = grp->gr_gid; + } +- wp->socket_gid = grp->gr_gid; + } + + return 0; diff --git a/fpm-reload-sighup.patch b/fpm-reload-sighup.patch new file mode 100644 index 000000000000..09b32b73ba06 --- /dev/null +++ b/fpm-reload-sighup.patch @@ -0,0 +1,57 @@ +diff --git a/sapi/fpm/fpm/fpm_events.c b/sapi/fpm/fpm/fpm_events.c +index ce5d543..63de0a4 100644 +--- a/sapi/fpm/fpm/fpm_events.c ++++ b/sapi/fpm/fpm/fpm_events.c +@@ -113,6 +113,11 @@ + zlog(ZLOG_NOTICE, "Reloading in progress ..."); + fpm_pctl(FPM_PCTL_STATE_RELOADING, FPM_PCTL_ACTION_SET); + break; ++ case 'H' : /* SIGHUP */ ++ zlog(ZLOG_DEBUG, "received SIGHUP"); ++ zlog(ZLOG_NOTICE, "Reloading in progress ..."); ++ fpm_pctl(FPM_PCTL_STATE_RELOADING, FPM_PCTL_ACTION_SET); ++ break; + } + + if (fpm_globals.is_child) { +diff --git a/sapi/fpm/fpm/fpm_signals.c b/sapi/fpm/fpm/fpm_signals.c +index c5d0692..9fae650 100644 +--- a/sapi/fpm/fpm/fpm_signals.c ++++ b/sapi/fpm/fpm/fpm_signals.c +@@ -160,6 +160,7 @@ + [SIGINT] = 'I', + [SIGUSR1] = '1', + [SIGUSR2] = '2', ++ [SIGHUP] = 'H', + [SIGQUIT] = 'Q', + [SIGCHLD] = 'C' + }; +@@ -206,6 +207,7 @@ + 0 > sigaction(SIGINT, &act, 0) || + 0 > sigaction(SIGUSR1, &act, 0) || + 0 > sigaction(SIGUSR2, &act, 0) || ++ 0 > sigaction(SIGHUP, &act, 0) || + 0 > sigaction(SIGCHLD, &act, 0) || + 0 > sigaction(SIGQUIT, &act, 0)) { + +@@ -235,6 +237,7 @@ + 0 > sigaction(SIGINT, &act_dfl, 0) || + 0 > sigaction(SIGUSR1, &act_dfl, 0) || + 0 > sigaction(SIGUSR2, &act_dfl, 0) || ++ 0 > sigaction(SIGHUP, &act_dfl, 0) || + 0 > sigaction(SIGCHLD, &act_dfl, 0) || + 0 > sigaction(SIGQUIT, &act, 0)) { + +diff --git a/sapi/fpm/php-fpm.8.in b/sapi/fpm/php-fpm.8.in +index 794f508..b1bcf08 100644 +--- a/sapi/fpm/php-fpm.8.in ++++ b/sapi/fpm/php-fpm.8.in +@@ -150,7 +150,7 @@ + .TP + .B SIGUSR1 \fPre-open log file + .TP +-.B SIGUSR2 \fPgraceful reload of all workers + reload of fpm conf/binary ++.B SIGUSR2,SIGHUP \fPgraceful reload of all workers + reload of fpm conf/binary + .RE + .PD 1 + .P diff --git a/logrotate.d.php-fpm b/logrotate.d.php-fpm deleted file mode 100644 index 4938af9cd163..000000000000 --- a/logrotate.d.php-fpm +++ /dev/null @@ -1,8 +0,0 @@ -/var/log/php56-fpm.log { - missingok - notifempty - delaycompress - postrotate - /bin/kill -SIGUSR1 `cat /run/php56-fpm/php-fpm.pid 2>/dev/null` 2>/dev/null || true - endscript -} diff --git a/make-tests.patch b/make-tests.patch new file mode 100644 index 000000000000..fe7d21ea5aab --- /dev/null +++ b/make-tests.patch @@ -0,0 +1,11 @@ +--- a/Makefile ++++ b/Makefile +@@ -213,7 +213,7 @@ + fi; \ + TEST_PHP_EXECUTABLE=$(PHP_EXECUTABLE) \ + TEST_PHP_SRCDIR=$(top_srcdir) \ +- CC="$(CC)" \ ++ REPORT_EXIT_STATUS=1 NO_INTERACTION=1 SKIP_ONLINE_TESTS=1 SKIP_SLOW_TESTS=1 CC="$(CC)" \ + $(PHP_EXECUTABLE) -n -c $(top_builddir)/tmp-php.ini $(PHP_TEST_SETTINGS) $(top_srcdir)/run-tests.php -n -c $(top_builddir)/tmp-php.ini -d extension_dir=$(top_builddir)/modules/ $(PHP_TEST_SHARED_EXTENSIONS) $(TESTS); \ + TEST_RESULT_EXIT_CODE=$$?; \ + rm $(top_builddir)/tmp-php.ini; \ diff --git a/mysql-socket-php5.3.patch b/mysql-socket-php5.3.patch new file mode 100644 index 000000000000..814ec7e8b270 --- /dev/null +++ b/mysql-socket-php5.3.patch @@ -0,0 +1,22 @@ +--- a/ext/pdo_mysql/pdo_mysql.c ++++ b/ext/pdo_mysql/pdo_mysql.c +@@ -51,7 +51,7 @@ + # define PDO_MYSQL_UNIX_ADDR PHP_MYSQL_UNIX_SOCK_ADDR + # else + # if !PHP_WIN32 +-# define PDO_MYSQL_UNIX_ADDR "/tmp/mysql.sock" ++# define PDO_MYSQL_UNIX_ADDR "/run/mysqld/mysqld.sock" + # else + # define PDO_MYSQL_UNIX_ADDR NULL + # endif +--- a/ext/mysqlnd/mysqlnd.c ++++ a/ext/mysqlnd/mysqlnd.c +@@ -958,7 +958,7 @@ + if (host_len == sizeof("localhost") - 1 && !strncasecmp(host, "localhost", host_len)) { + DBG_INF_FMT("socket=%s", socket_or_pipe? socket_or_pipe:"n/a"); + if (!socket_or_pipe) { +- socket_or_pipe = "/tmp/mysql.sock"; ++ socket_or_pipe = "/run/mysqld/mysqld.sock"; + } + transport_len = mnd_sprintf(&transport, 0, "unix://%s", socket_or_pipe); + unix_socket = TRUE; diff --git a/openssl-1.1.patch b/openssl-1.1.patch new file mode 100644 index 000000000000..71dc08835548 --- /dev/null +++ b/openssl-1.1.patch @@ -0,0 +1,1316 @@ +diff --git a/ext/openssl/openssl.c b/ext/openssl/openssl.c +index a78a8fb..b53114c 100644 +--- a/ext/openssl/openssl.c ++++ b/ext/openssl/openssl.c +@@ -42,6 +42,12 @@ + + /* OpenSSL includes */ + #include <openssl/evp.h> ++#if OPENSSL_VERSION_NUMBER >= 0x10002000L ++#include <openssl/bn.h> ++#include <openssl/rsa.h> ++#include <openssl/dsa.h> ++#include <openssl/dh.h> ++#endif + #include <openssl/x509.h> + #include <openssl/x509v3.h> + #include <openssl/crypto.h> +@@ -531,6 +537,133 @@ + ZEND_GET_MODULE(openssl) + #endif + ++/* {{{ OpenSSL compatibility functions and macros */ ++#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined (LIBRESSL_VERSION_NUMBER) ++#define EVP_PKEY_get0_RSA(_pkey) _pkey->pkey.rsa ++#define EVP_PKEY_get0_DH(_pkey) _pkey->pkey.dh ++#define EVP_PKEY_get0_DSA(_pkey) _pkey->pkey.dsa ++#define EVP_PKEY_get0_EC_KEY(_pkey) _pkey->pkey.ec ++ ++static int RSA_set0_key(RSA *r, BIGNUM *n, BIGNUM *e, BIGNUM *d) ++{ ++ r->n = n; ++ r->e = e; ++ r->d = d; ++ ++ return 1; ++} ++ ++static int RSA_set0_factors(RSA *r, BIGNUM *p, BIGNUM *q) ++{ ++ r->p = p; ++ r->q = q; ++ ++ return 1; ++} ++ ++static int RSA_set0_crt_params(RSA *r, BIGNUM *dmp1, BIGNUM *dmq1, BIGNUM *iqmp) ++{ ++ r->dmp1 = dmp1; ++ r->dmq1 = dmq1; ++ r->iqmp = iqmp; ++ ++ return 1; ++} ++ ++static void RSA_get0_key(const RSA *r, const BIGNUM **n, const BIGNUM **e, const BIGNUM **d) ++{ ++ *n = r->n; ++ *e = r->e; ++ *d = r->d; ++} ++ ++static void RSA_get0_factors(const RSA *r, const BIGNUM **p, const BIGNUM **q) ++{ ++ *p = r->p; ++ *q = r->q; ++} ++ ++static void RSA_get0_crt_params(const RSA *r, const BIGNUM **dmp1, const BIGNUM **dmq1, const BIGNUM **iqmp) ++{ ++ *dmp1 = r->dmp1; ++ *dmq1 = r->dmq1; ++ *iqmp = r->iqmp; ++} ++ ++static void DH_get0_pqg(const DH *dh, const BIGNUM **p, const BIGNUM **q, const BIGNUM **g) ++{ ++ *p = dh->p; ++ *q = dh->q; ++ *g = dh->g; ++} ++ ++static int DH_set0_pqg(DH *dh, BIGNUM *p, BIGNUM *q, BIGNUM *g) ++{ ++ dh->p = p; ++ dh->q = q; ++ dh->g = g; ++ ++ return 1; ++} ++ ++static void DH_get0_key(const DH *dh, const BIGNUM **pub_key, const BIGNUM **priv_key) ++{ ++ *pub_key = dh->pub_key; ++ *priv_key = dh->priv_key; ++} ++ ++static int DH_set0_key(DH *dh, BIGNUM *pub_key, BIGNUM *priv_key) ++{ ++ dh->pub_key = pub_key; ++ dh->priv_key = priv_key; ++ ++ return 1; ++} ++ ++static void DSA_get0_pqg(const DSA *d, const BIGNUM **p, const BIGNUM **q, const BIGNUM **g) ++{ ++ *p = d->p; ++ *q = d->q; ++ *g = d->g; ++} ++ ++int DSA_set0_pqg(DSA *d, BIGNUM *p, BIGNUM *q, BIGNUM *g) ++{ ++ d->p = p; ++ d->q = q; ++ d->g = g; ++ ++ return 1; ++} ++ ++static void DSA_get0_key(const DSA *d, const BIGNUM **pub_key, const BIGNUM **priv_key) ++{ ++ *pub_key = d->pub_key; ++ *priv_key = d->priv_key; ++} ++ ++int DSA_set0_key(DSA *d, BIGNUM *pub_key, BIGNUM *priv_key) ++{ ++ d->pub_key = pub_key; ++ d->priv_key = priv_key; ++ ++ return 1; ++} ++ ++#if OPENSSL_VERSION_NUMBER < 0x10002000L || defined (LIBRESSL_VERSION_NUMBER) ++#define EVP_PKEY_id(_pkey) _pkey->type ++#define EVP_PKEY_base_id(_key) EVP_PKEY_type(_key->type) ++ ++static int X509_get_signature_nid(const X509 *x) ++{ ++ return OBJ_obj2nid(x->sig_alg->algorithm); ++} ++ ++#endif ++ ++#endif ++/* }}} */ ++ + static int le_key; + static int le_x509; + static int le_csr; +@@ -825,7 +958,7 @@ + } + for (i = 0; i < sk_CONF_VALUE_num(sktmp); i++) { + cnf = sk_CONF_VALUE_value(sktmp, i); +- if (OBJ_create(cnf->value, cnf->name, cnf->name) == NID_undef) { ++ if (OBJ_sn2nid(cnf->name) == NID_undef && OBJ_ln2nid(cnf->name) == NID_undef && OBJ_create(cnf->value, cnf->name, cnf->name) == NID_undef) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "problem creating object %s=%s", cnf->name, cnf->value); + return FAILURE; + } +@@ -967,7 +1100,7 @@ + } + /* }}} */ + +-#ifdef PHP_WIN32 ++#if defined(PHP_WIN32) || (OPENSSL_VERSION_NUMBER >= 0x10100000L && !defined(LIBRESSL_VERSION_NUMBER)) + #define PHP_OPENSSL_RAND_ADD_TIME() ((void) 0) + #else + #define PHP_OPENSSL_RAND_ADD_TIME() php_openssl_rand_add_timeval() +@@ -1053,9 +1186,11 @@ + mdtype = (EVP_MD *) EVP_md2(); + break; + #endif ++#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined (LIBRESSL_VERSION_NUMBER) + case OPENSSL_ALGO_DSS1: + mdtype = (EVP_MD *) EVP_dss1(); + break; ++#endif + #if OPENSSL_VERSION_NUMBER >= 0x0090708fL + case OPENSSL_ALGO_SHA224: + mdtype = (EVP_MD *) EVP_sha224(); +@@ -1146,6 +1281,12 @@ + OpenSSL_add_all_digests(); + OpenSSL_add_all_algorithms(); + ++#if !defined(OPENSSL_NO_AES) && defined(EVP_CIPH_CCM_MODE) && OPENSSL_VERSION_NUMBER < 0x100020000 ++ EVP_add_cipher(EVP_aes_128_ccm()); ++ EVP_add_cipher(EVP_aes_192_ccm()); ++ EVP_add_cipher(EVP_aes_256_ccm()); ++#endif ++ + SSL_load_error_strings(); + + /* register a resource id number with OpenSSL so that we can map SSL -> stream structures in +@@ -1173,7 +1314,9 @@ + #ifdef HAVE_OPENSSL_MD2_H + REGISTER_LONG_CONSTANT("OPENSSL_ALGO_MD2", OPENSSL_ALGO_MD2, CONST_CS|CONST_PERSISTENT); + #endif ++#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined (LIBRESSL_VERSION_NUMBER) + REGISTER_LONG_CONSTANT("OPENSSL_ALGO_DSS1", OPENSSL_ALGO_DSS1, CONST_CS|CONST_PERSISTENT); ++#endif + #if OPENSSL_VERSION_NUMBER >= 0x0090708fL + REGISTER_LONG_CONSTANT("OPENSSL_ALGO_SHA224", OPENSSL_ALGO_SHA224, CONST_CS|CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("OPENSSL_ALGO_SHA256", OPENSSL_ALGO_SHA256, CONST_CS|CONST_PERSISTENT); +@@ -1251,7 +1394,9 @@ + } + + php_stream_xport_register("ssl", php_openssl_ssl_socket_factory TSRMLS_CC); ++#ifndef OPENSSL_NO_SSL3 + php_stream_xport_register("sslv3", php_openssl_ssl_socket_factory TSRMLS_CC); ++#endif + #ifndef OPENSSL_NO_SSL2 + php_stream_xport_register("sslv2", php_openssl_ssl_socket_factory TSRMLS_CC); + #endif +@@ -1308,7 +1453,9 @@ + #ifndef OPENSSL_NO_SSL2 + php_stream_xport_unregister("sslv2" TSRMLS_CC); + #endif ++#ifndef OPENSSL_NO_SSL3 + php_stream_xport_unregister("sslv3" TSRMLS_CC); ++#endif + php_stream_xport_unregister("tls" TSRMLS_CC); + php_stream_xport_unregister("tlsv1.0" TSRMLS_CC); + #if OPENSSL_VERSION_NUMBER >= 0x10001001L +@@ -1893,6 +2040,7 @@ + { + GENERAL_NAMES *names; + const X509V3_EXT_METHOD *method = NULL; ++ ASN1_OCTET_STRING *extension_data; + long i, length, num; + const unsigned char *p; + +@@ -1901,8 +2049,9 @@ + return -1; + } + +- p = extension->value->data; +- length = extension->value->length; ++ extension_data = X509_EXTENSION_get_data(extension); ++ p = extension_data->data; ++ length = extension_data->length; + if (method->it) { + names = (GENERAL_NAMES*)(ASN1_item_d2i(NULL, &p, length, + ASN1_ITEM_ptr(method->it))); +@@ -1965,6 +2114,8 @@ + char * tmpstr; + zval * subitem; + X509_EXTENSION *extension; ++ X509_NAME *subject_name; ++ char *cert_name; + char *extname; + BIO *bio_out; + BUF_MEM *bio_buf; +@@ -1979,10 +2130,10 @@ + } + array_init(return_value); + +- if (cert->name) { +- add_assoc_string(return_value, "name", cert->name, 1); +- } +-/* add_assoc_bool(return_value, "valid", cert->valid); */ ++ subject_name = X509_get_subject_name(cert); ++ cert_name = X509_NAME_oneline(subject_name, NULL, 0); ++ add_assoc_string(return_value, "name", cert_name, 1); ++ OPENSSL_free(cert_name); + + add_assoc_name_entry(return_value, "subject", X509_get_subject_name(cert), useshortnames TSRMLS_CC); + /* hash as used in CA directories to lookup cert by subject name */ +@@ -2008,7 +2159,7 @@ + add_assoc_string(return_value, "alias", tmpstr, 1); + } + +- sig_nid = OBJ_obj2nid((cert)->sig_alg->algorithm); ++ sig_nid = X509_get_signature_nid(cert); + add_assoc_string(return_value, "signatureTypeSN", (char*)OBJ_nid2sn(sig_nid), 1); + add_assoc_string(return_value, "signatureTypeLN", (char*)OBJ_nid2ln(sig_nid), 1); + add_assoc_long(return_value, "signatureTypeNID", sig_nid); +@@ -3217,7 +3368,21 @@ + RETURN_FALSE; + } + +- tpubkey=X509_REQ_get_pubkey(csr); ++#if OPENSSL_VERSION_NUMBER >= 0x10100000L && !defined(LIBRESSL_VERSION_NUMBER) ++ /* Due to changes in OpenSSL 1.1 related to locking when decoding CSR, ++ * the pub key is not changed after assigning. It means if we pass ++ * a private key, it will be returned including the private part. ++ * If we duplicate it, then we get just the public part which is ++ * the same behavior as for OpenSSL 1.0 */ ++ csr = X509_REQ_dup(csr); ++#endif ++ /* Retrieve the public key from the CSR */ ++ tpubkey = X509_REQ_get_pubkey(csr); ++ ++#if OPENSSL_VERSION_NUMBER >= 0x10100000L && !defined(LIBRESSL_VERSION_NUMBER) ++ /* We need to free the CSR as it was duplicated */ ++ X509_REQ_free(csr); ++#endif + RETVAL_RESOURCE(zend_list_insert(tpubkey, le_key TSRMLS_CC)); + return; + } +@@ -3482,13 +3647,20 @@ + { + assert(pkey != NULL); + +- switch (pkey->type) { ++ switch (EVP_PKEY_id(pkey)) { + #ifndef NO_RSA + case EVP_PKEY_RSA: + case EVP_PKEY_RSA2: +- assert(pkey->pkey.rsa != NULL); +- if (pkey->pkey.rsa != NULL && (NULL == pkey->pkey.rsa->p || NULL == pkey->pkey.rsa->q)) { +- return 0; ++ { ++ RSA *rsa = EVP_PKEY_get0_RSA(pkey); ++ if (rsa != NULL) { ++ const BIGNUM *p, *q; ++ ++ RSA_get0_factors(rsa, &p, &q); ++ if (p == NULL || q == NULL) { ++ return 0; ++ } ++ } + } + break; + #endif +@@ -3498,28 +3670,51 @@ + case EVP_PKEY_DSA2: + case EVP_PKEY_DSA3: + case EVP_PKEY_DSA4: +- assert(pkey->pkey.dsa != NULL); +- +- if (NULL == pkey->pkey.dsa->p || NULL == pkey->pkey.dsa->q || NULL == pkey->pkey.dsa->priv_key){ +- return 0; ++ { ++ DSA *dsa = EVP_PKEY_get0_DSA(pkey); ++ if (dsa != NULL) { ++ const BIGNUM *p, *q, *g, *pub_key, *priv_key; ++ ++ DSA_get0_pqg(dsa, &p, &q, &g); ++ if (p == NULL || q == NULL) { ++ return 0; ++ } ++ ++ DSA_get0_key(dsa, &pub_key, &priv_key); ++ if (priv_key == NULL) { ++ return 0; ++ } ++ } + } + break; + #endif + #ifndef NO_DH + case EVP_PKEY_DH: +- assert(pkey->pkey.dh != NULL); +- +- if (NULL == pkey->pkey.dh->p || NULL == pkey->pkey.dh->priv_key) { +- return 0; ++ { ++ DH *dh = EVP_PKEY_get0_DH(pkey); ++ if (dh != NULL) { ++ const BIGNUM *p, *q, *g, *pub_key, *priv_key; ++ ++ DH_get0_pqg(dh, &p, &q, &g); ++ if (p == NULL) { ++ return 0; ++ } ++ ++ DH_get0_key(dh, &pub_key, &priv_key); ++ if (priv_key == NULL) { ++ return 0; ++ } ++ } + } + break; + #endif + #ifdef HAVE_EVP_PKEY_EC + case EVP_PKEY_EC: +- assert(pkey->pkey.ec != NULL); +- +- if ( NULL == EC_KEY_get0_private_key(pkey->pkey.ec)) { +- return 0; ++ { ++ EC_KEY *ec = EVP_PKEY_get0_EC_KEY(pkey); ++ if (ec != NULL && NULL == EC_KEY_get0_private_key(ec)) { ++ return 0; ++ } + } + break; + #endif +@@ -3531,34 +3726,80 @@ + } + /* }}} */ + +-#define OPENSSL_PKEY_GET_BN(_type, _name) do { \ +- if (pkey->pkey._type->_name != NULL) { \ +- int len = BN_num_bytes(pkey->pkey._type->_name); \ +- char *str = emalloc(len + 1); \ +- BN_bn2bin(pkey->pkey._type->_name, (unsigned char*)str); \ +- str[len] = 0; \ +- add_assoc_stringl(_type, #_name, str, len, 0); \ +- } \ +- } while (0) +- +-#define OPENSSL_PKEY_SET_BN(_ht, _type, _name) do { \ +- zval **bn; \ +- if (zend_hash_find(_ht, #_name, sizeof(#_name), (void**)&bn) == SUCCESS && \ +- Z_TYPE_PP(bn) == IS_STRING) { \ +- _type->_name = BN_bin2bn( \ +- (unsigned char*)Z_STRVAL_PP(bn), \ +- Z_STRLEN_PP(bn), NULL); \ +- } \ ++#define OPENSSL_GET_BN(_array, _bn, _name) do { \ ++ if (_bn != NULL) { \ ++ int len = BN_num_bytes(_bn); \ ++ char *str = emalloc(len + 1); \ ++ BN_bn2bin(_bn, (unsigned char*)str); \ ++ str[len] = 0; \ ++ add_assoc_stringl(_array, #_name, str, len, 0); \ ++ } \ + } while (0); + ++#define OPENSSL_PKEY_GET_BN(_type, _name) OPENSSL_GET_BN(_type, _name, _name) ++ ++#define OPENSSL_PKEY_SET_BN(_data, _name) do { \ ++ zval **bn; \ ++ if (zend_hash_find(Z_ARRVAL_P(_data), #_name, sizeof(#_name),(void**)&bn) == SUCCESS && \ ++ Z_TYPE_PP(bn) == IS_STRING) { \ ++ _name = BN_bin2bn( \ ++ (unsigned char*)Z_STRVAL_PP(bn), \ ++ Z_STRLEN_PP(bn), NULL); \ ++ } else { \ ++ _name = NULL; \ ++ } \ ++ } while (0); ++ ++/* {{{ php_openssl_pkey_init_rsa */ ++zend_bool php_openssl_pkey_init_and_assign_rsa(EVP_PKEY *pkey, RSA *rsa, zval *data) ++{ ++ BIGNUM *n, *e, *d, *p, *q, *dmp1, *dmq1, *iqmp; ++ ++ OPENSSL_PKEY_SET_BN(data, n); ++ OPENSSL_PKEY_SET_BN(data, e); ++ OPENSSL_PKEY_SET_BN(data, d); ++ if (!n || !d || !RSA_set0_key(rsa, n, e, d)) { ++ return 0; ++ } ++ ++ OPENSSL_PKEY_SET_BN(data, p); ++ OPENSSL_PKEY_SET_BN(data, q); ++ if ((p || q) && !RSA_set0_factors(rsa, p, q)) { ++ return 0; ++ } ++ ++ OPENSSL_PKEY_SET_BN(data, dmp1); ++ OPENSSL_PKEY_SET_BN(data, dmq1); ++ OPENSSL_PKEY_SET_BN(data, iqmp); ++ if ((dmp1 || dmq1 || iqmp) && !RSA_set0_crt_params(rsa, dmp1, dmq1, iqmp)) { ++ return 0; ++ } ++ ++ if (!EVP_PKEY_assign_RSA(pkey, rsa)) { ++ return 0; ++ } ++ ++ return 1; ++} ++/* }}} */ ++ + /* {{{ php_openssl_pkey_init_dsa */ +-zend_bool php_openssl_pkey_init_dsa(DSA *dsa) ++zend_bool php_openssl_pkey_init_dsa(DSA *dsa, zval *data) + { +- if (!dsa->p || !dsa->q || !dsa->g) { ++ BIGNUM *p, *q, *g, *priv_key, *pub_key; ++ const BIGNUM *priv_key_const, *pub_key_const; ++ ++ OPENSSL_PKEY_SET_BN(data, p); ++ OPENSSL_PKEY_SET_BN(data, q); ++ OPENSSL_PKEY_SET_BN(data, g); ++ if (!p || !q || !g || !DSA_set0_pqg(dsa, p, q, g)) { + return 0; + } +- if (dsa->priv_key || dsa->pub_key) { +- return 1; ++ ++ OPENSSL_PKEY_SET_BN(data, pub_key); ++ OPENSSL_PKEY_SET_BN(data, priv_key); ++ if (pub_key) { ++ return DSA_set0_key(dsa, pub_key, priv_key); + } + PHP_OPENSSL_RAND_ADD_TIME(); + if (!DSA_generate_key(dsa)) { +@@ -3566,7 +3807,8 @@ + } + /* if BN_mod_exp return -1, then DSA_generate_key succeed for failed key + * so we need to double check that public key is created */ +- if (!dsa->pub_key || BN_is_zero(dsa->pub_key)) { ++ DSA_get0_key(dsa, &pub_key_const, &priv_key_const); ++ if (!pub_key_const || BN_is_zero(pub_key_const)) { + return 0; + } + /* all good */ +@@ -3574,14 +3816,66 @@ + } + /* }}} */ + ++/* {{{ php_openssl_dh_pub_from_priv */ ++static BIGNUM *php_openssl_dh_pub_from_priv(BIGNUM *priv_key, BIGNUM *g, BIGNUM *p) ++{ ++ BIGNUM *pub_key, *priv_key_const_time; ++ BN_CTX *ctx; ++ ++ pub_key = BN_new(); ++ if (pub_key == NULL) { ++ return NULL; ++ } ++ ++ priv_key_const_time = BN_new(); ++ if (priv_key_const_time == NULL) { ++ BN_free(pub_key); ++ return NULL; ++ } ++ ctx = BN_CTX_new(); ++ if (ctx == NULL) { ++ BN_free(pub_key); ++ BN_free(priv_key_const_time); ++ return NULL; ++ } ++ ++ BN_with_flags(priv_key_const_time, priv_key, BN_FLG_CONSTTIME); ++ ++ if (!BN_mod_exp_mont(pub_key, g, priv_key_const_time, p, ctx, NULL)) { ++ BN_free(pub_key); ++ pub_key = NULL; ++ } ++ ++ BN_free(priv_key_const_time); ++ BN_CTX_free(ctx); ++ ++ return pub_key; ++} ++/* }}} */ ++ + /* {{{ php_openssl_pkey_init_dh */ +-zend_bool php_openssl_pkey_init_dh(DH *dh) ++zend_bool php_openssl_pkey_init_dh(DH *dh, zval *data) + { +- if (!dh->p || !dh->g) { ++ BIGNUM *p, *q, *g, *priv_key, *pub_key; ++ ++ OPENSSL_PKEY_SET_BN(data, p); ++ OPENSSL_PKEY_SET_BN(data, q); ++ OPENSSL_PKEY_SET_BN(data, g); ++ if (!p || !g || !DH_set0_pqg(dh, p, q, g)) { + return 0; + } +- if (dh->pub_key) { +- return 1; ++ ++ OPENSSL_PKEY_SET_BN(data, priv_key); ++ OPENSSL_PKEY_SET_BN(data, pub_key); ++ if (pub_key) { ++ return DH_set0_key(dh, pub_key, priv_key); ++ } ++ if (priv_key) { ++ pub_key = php_openssl_dh_pub_from_priv(priv_key, g, p); ++ if (pub_key == NULL) { ++ return 0; ++ } ++ return DH_set0_key(dh, pub_key, priv_key); + } + PHP_OPENSSL_RAND_ADD_TIME(); + if (!DH_generate_key(dh)) { +@@ -3614,18 +3908,8 @@ + if (pkey) { + RSA *rsa = RSA_new(); + if (rsa) { +- OPENSSL_PKEY_SET_BN(Z_ARRVAL_PP(data), rsa, n); +- OPENSSL_PKEY_SET_BN(Z_ARRVAL_PP(data), rsa, e); +- OPENSSL_PKEY_SET_BN(Z_ARRVAL_PP(data), rsa, d); +- OPENSSL_PKEY_SET_BN(Z_ARRVAL_PP(data), rsa, p); +- OPENSSL_PKEY_SET_BN(Z_ARRVAL_PP(data), rsa, q); +- OPENSSL_PKEY_SET_BN(Z_ARRVAL_PP(data), rsa, dmp1); +- OPENSSL_PKEY_SET_BN(Z_ARRVAL_PP(data), rsa, dmq1); +- OPENSSL_PKEY_SET_BN(Z_ARRVAL_PP(data), rsa, iqmp); +- if (rsa->n && rsa->d) { +- if (EVP_PKEY_assign_RSA(pkey, rsa)) { +- RETURN_RESOURCE(zend_list_insert(pkey, le_key TSRMLS_CC)); +- } ++ if (php_openssl_pkey_init_and_assign_rsa(pkey, rsa, *data)) { ++ RETURN_RESOURCE(zend_list_insert(pkey, le_key TSRMLS_CC)); + } + RSA_free(rsa); + } +@@ -3638,12 +3922,7 @@ + if (pkey) { + DSA *dsa = DSA_new(); + if (dsa) { +- OPENSSL_PKEY_SET_BN(Z_ARRVAL_PP(data), dsa, p); +- OPENSSL_PKEY_SET_BN(Z_ARRVAL_PP(data), dsa, q); +- OPENSSL_PKEY_SET_BN(Z_ARRVAL_PP(data), dsa, g); +- OPENSSL_PKEY_SET_BN(Z_ARRVAL_PP(data), dsa, priv_key); +- OPENSSL_PKEY_SET_BN(Z_ARRVAL_PP(data), dsa, pub_key); +- if (php_openssl_pkey_init_dsa(dsa)) { ++ if (php_openssl_pkey_init_dsa(dsa, *data)) { + if (EVP_PKEY_assign_DSA(pkey, dsa)) { + RETURN_RESOURCE(zend_list_insert(pkey, le_key TSRMLS_CC)); + } +@@ -3659,11 +3938,7 @@ + if (pkey) { + DH *dh = DH_new(); + if (dh) { +- OPENSSL_PKEY_SET_BN(Z_ARRVAL_PP(data), dh, p); +- OPENSSL_PKEY_SET_BN(Z_ARRVAL_PP(data), dh, g); +- OPENSSL_PKEY_SET_BN(Z_ARRVAL_PP(data), dh, priv_key); +- OPENSSL_PKEY_SET_BN(Z_ARRVAL_PP(data), dh, pub_key); +- if (php_openssl_pkey_init_dh(dh)) { ++ if (php_openssl_pkey_init_dh(dh, *data)) { + if (EVP_PKEY_assign_DH(pkey, dh)) { + RETURN_RESOURCE(zend_list_insert(pkey, le_key TSRMLS_CC)); + } +@@ -3738,10 +4013,10 @@ + cipher = NULL; + } + +- switch (EVP_PKEY_type(key->type)) { ++ switch (EVP_PKEY_base_id(key)) { + #ifdef HAVE_EVP_PKEY_EC + case EVP_PKEY_EC: +- pem_write = PEM_write_bio_ECPrivateKey(bio_out, EVP_PKEY_get1_EC_KEY(key), cipher, (unsigned char *)passphrase, passphrase_len, NULL, NULL); ++ pem_write = PEM_write_bio_ECPrivateKey(bio_out, EVP_PKEY_get0_EC_KEY(key), cipher, (unsigned char *)passphrase, passphrase_len, NULL, NULL); + break; + #endif + default: +@@ -3807,7 +4082,7 @@ + cipher = NULL; + } + +- switch (EVP_PKEY_type(key->type)) { ++ switch (EVP_PKEY_base_id(key)) { + #ifdef HAVE_EVP_PKEY_EC + case EVP_PKEY_EC: + pem_write = PEM_write_bio_ECPrivateKey(bio_out, EVP_PKEY_get1_EC_KEY(key), cipher, (unsigned char *)passphrase, passphrase_len, NULL, NULL); +@@ -3928,25 +4203,33 @@ + /*TODO: Use the real values once the openssl constants are used + * See the enum at the top of this file + */ +- switch (EVP_PKEY_type(pkey->type)) { ++ switch (EVP_PKEY_base_id(pkey)) { + case EVP_PKEY_RSA: + case EVP_PKEY_RSA2: +- ktype = OPENSSL_KEYTYPE_RSA; +- +- if (pkey->pkey.rsa != NULL) { +- zval *rsa; +- +- ALLOC_INIT_ZVAL(rsa); +- array_init(rsa); +- OPENSSL_PKEY_GET_BN(rsa, n); +- OPENSSL_PKEY_GET_BN(rsa, e); +- OPENSSL_PKEY_GET_BN(rsa, d); +- OPENSSL_PKEY_GET_BN(rsa, p); +- OPENSSL_PKEY_GET_BN(rsa, q); +- OPENSSL_PKEY_GET_BN(rsa, dmp1); +- OPENSSL_PKEY_GET_BN(rsa, dmq1); +- OPENSSL_PKEY_GET_BN(rsa, iqmp); +- add_assoc_zval(return_value, "rsa", rsa); ++ { ++ RSA *rsa = EVP_PKEY_get0_RSA(pkey); ++ ktype = OPENSSL_KEYTYPE_RSA; ++ ++ if (rsa != NULL) { ++ zval *z_rsa; ++ const BIGNUM *n, *e, *d, *p, *q, *dmp1, *dmq1, *iqmp; ++ ++ RSA_get0_key(rsa, &n, &e, &d); ++ RSA_get0_factors(rsa, &p, &q); ++ RSA_get0_crt_params(rsa, &dmp1, &dmq1, &iqmp); ++ ++ ALLOC_INIT_ZVAL(z_rsa); ++ array_init(z_rsa); ++ OPENSSL_PKEY_GET_BN(z_rsa, n); ++ OPENSSL_PKEY_GET_BN(z_rsa, e); ++ OPENSSL_PKEY_GET_BN(z_rsa, d); ++ OPENSSL_PKEY_GET_BN(z_rsa, p); ++ OPENSSL_PKEY_GET_BN(z_rsa, q); ++ OPENSSL_PKEY_GET_BN(z_rsa, dmp1); ++ OPENSSL_PKEY_GET_BN(z_rsa, dmq1); ++ OPENSSL_PKEY_GET_BN(z_rsa, iqmp); ++ add_assoc_zval(return_value, "rsa", z_rsa); ++ } + } + + break; +@@ -3954,42 +4237,55 @@ + case EVP_PKEY_DSA2: + case EVP_PKEY_DSA3: + case EVP_PKEY_DSA4: +- ktype = OPENSSL_KEYTYPE_DSA; +- +- if (pkey->pkey.dsa != NULL) { +- zval *dsa; +- +- ALLOC_INIT_ZVAL(dsa); +- array_init(dsa); +- OPENSSL_PKEY_GET_BN(dsa, p); +- OPENSSL_PKEY_GET_BN(dsa, q); +- OPENSSL_PKEY_GET_BN(dsa, g); +- OPENSSL_PKEY_GET_BN(dsa, priv_key); +- OPENSSL_PKEY_GET_BN(dsa, pub_key); +- add_assoc_zval(return_value, "dsa", dsa); ++ { ++ DSA *dsa = EVP_PKEY_get0_DSA(pkey); ++ ktype = OPENSSL_KEYTYPE_DSA; ++ ++ if (dsa != NULL) { ++ zval *z_dsa; ++ const BIGNUM *p, *q, *g, *priv_key, *pub_key; ++ ++ DSA_get0_pqg(dsa, &p, &q, &g); ++ DSA_get0_key(dsa, &pub_key, &priv_key); ++ ++ ALLOC_INIT_ZVAL(z_dsa); ++ array_init(z_dsa); ++ OPENSSL_PKEY_GET_BN(z_dsa, p); ++ OPENSSL_PKEY_GET_BN(z_dsa, q); ++ OPENSSL_PKEY_GET_BN(z_dsa, g); ++ OPENSSL_PKEY_GET_BN(z_dsa, priv_key); ++ OPENSSL_PKEY_GET_BN(z_dsa, pub_key); ++ add_assoc_zval(return_value, "dsa", z_dsa); ++ } + } + break; + case EVP_PKEY_DH: +- +- ktype = OPENSSL_KEYTYPE_DH; +- +- if (pkey->pkey.dh != NULL) { +- zval *dh; +- +- ALLOC_INIT_ZVAL(dh); +- array_init(dh); +- OPENSSL_PKEY_GET_BN(dh, p); +- OPENSSL_PKEY_GET_BN(dh, g); +- OPENSSL_PKEY_GET_BN(dh, priv_key); +- OPENSSL_PKEY_GET_BN(dh, pub_key); +- add_assoc_zval(return_value, "dh", dh); ++ { ++ DH *dh = EVP_PKEY_get0_DH(pkey); ++ ktype = OPENSSL_KEYTYPE_DH; ++ ++ if (dh != NULL) { ++ zval *z_dh; ++ const BIGNUM *p, *q, *g, *priv_key, *pub_key; ++ ++ DH_get0_pqg(dh, &p, &q, &g); ++ DH_get0_key(dh, &pub_key, &priv_key); ++ ++ ALLOC_INIT_ZVAL(z_dh); ++ array_init(z_dh); ++ OPENSSL_PKEY_GET_BN(z_dh, p); ++ OPENSSL_PKEY_GET_BN(z_dh, g); ++ OPENSSL_PKEY_GET_BN(z_dh, priv_key); ++ OPENSSL_PKEY_GET_BN(z_dh, pub_key); ++ add_assoc_zval(return_value, "dh", z_dh); ++ } + } + + break; + #ifdef HAVE_EVP_PKEY_EC + case EVP_PKEY_EC: + ktype = OPENSSL_KEYTYPE_EC; +- if (pkey->pkey.ec != NULL) { ++ if (EVP_PKEY_get0_EC_KEY(pkey) != NULL) { + zval *ec; + const EC_GROUP *ec_group; + int nid; +@@ -4546,13 +4842,13 @@ + cryptedlen = EVP_PKEY_size(pkey); + cryptedbuf = emalloc(cryptedlen + 1); + +- switch (pkey->type) { ++ switch (EVP_PKEY_id(pkey)) { + case EVP_PKEY_RSA: + case EVP_PKEY_RSA2: + successful = (RSA_private_encrypt(data_len, + (unsigned char *)data, + cryptedbuf, +- pkey->pkey.rsa, ++ EVP_PKEY_get0_RSA(pkey), + padding) == cryptedlen); + break; + default: +@@ -4604,13 +4900,13 @@ + cryptedlen = EVP_PKEY_size(pkey); + crypttemp = emalloc(cryptedlen + 1); + +- switch (pkey->type) { ++ switch (EVP_PKEY_id(pkey)) { + case EVP_PKEY_RSA: + case EVP_PKEY_RSA2: + cryptedlen = RSA_private_decrypt(data_len, + (unsigned char *)data, + crypttemp, +- pkey->pkey.rsa, ++ EVP_PKEY_get0_RSA(pkey), + padding); + if (cryptedlen != -1) { + cryptedbuf = emalloc(cryptedlen + 1); +@@ -4669,13 +4965,13 @@ + cryptedlen = EVP_PKEY_size(pkey); + cryptedbuf = emalloc(cryptedlen + 1); + +- switch (pkey->type) { ++ switch (EVP_PKEY_id(pkey)) { + case EVP_PKEY_RSA: + case EVP_PKEY_RSA2: + successful = (RSA_public_encrypt(data_len, + (unsigned char *)data, + cryptedbuf, +- pkey->pkey.rsa, ++ EVP_PKEY_get0_RSA(pkey), + padding) == cryptedlen); + break; + default: +@@ -4728,13 +5024,13 @@ + cryptedlen = EVP_PKEY_size(pkey); + crypttemp = emalloc(cryptedlen + 1); + +- switch (pkey->type) { ++ switch (EVP_PKEY_id(pkey)) { + case EVP_PKEY_RSA: + case EVP_PKEY_RSA2: + cryptedlen = RSA_public_decrypt(data_len, + (unsigned char *)data, + crypttemp, +- pkey->pkey.rsa, ++ EVP_PKEY_get0_RSA(pkey), + padding); + if (cryptedlen != -1) { + cryptedbuf = emalloc(cryptedlen + 1); +@@ -4798,7 +5094,7 @@ + long keyresource = -1; + char * data; + int data_len; +- EVP_MD_CTX md_ctx; ++ EVP_MD_CTX *md_ctx; + zval *method = NULL; + long signature_algo = OPENSSL_ALGO_SHA1; + const EVP_MD *mdtype; +@@ -4831,9 +5127,10 @@ + siglen = EVP_PKEY_size(pkey); + sigbuf = emalloc(siglen + 1); + +- EVP_SignInit(&md_ctx, mdtype); +- EVP_SignUpdate(&md_ctx, data, data_len); +- if (EVP_SignFinal (&md_ctx, sigbuf,(unsigned int *)&siglen, pkey)) { ++ md_ctx = EVP_MD_CTX_create(); ++ EVP_SignInit(md_ctx, mdtype); ++ EVP_SignUpdate(md_ctx, data, data_len); ++ if (EVP_SignFinal (md_ctx, sigbuf,(unsigned int *)&siglen, pkey)) { + zval_dtor(signature); + sigbuf[siglen] = '\0'; + ZVAL_STRINGL(signature, (char *)sigbuf, siglen, 0); +@@ -4842,7 +5139,7 @@ + efree(sigbuf); + RETVAL_FALSE; + } +- EVP_MD_CTX_cleanup(&md_ctx); ++ EVP_MD_CTX_destroy(md_ctx); + if (keyresource == -1) { + EVP_PKEY_free(pkey); + } +@@ -4856,7 +5153,7 @@ + zval **key; + EVP_PKEY *pkey; + int err; +- EVP_MD_CTX md_ctx; ++ EVP_MD_CTX *md_ctx; + const EVP_MD *mdtype; + long keyresource = -1; + char * data; int data_len; +@@ -4890,10 +5187,11 @@ + RETURN_FALSE; + } + +- EVP_VerifyInit (&md_ctx, mdtype); +- EVP_VerifyUpdate (&md_ctx, data, data_len); +- err = EVP_VerifyFinal (&md_ctx, (unsigned char *)signature, signature_len, pkey); +- EVP_MD_CTX_cleanup(&md_ctx); ++ md_ctx = EVP_MD_CTX_create(); ++ EVP_VerifyInit (md_ctx, mdtype); ++ EVP_VerifyUpdate (md_ctx, data, data_len); ++ err = EVP_VerifyFinal (md_ctx, (unsigned char *)signature, signature_len, pkey); ++ EVP_MD_CTX_destroy(md_ctx); + + if (keyresource == -1) { + EVP_PKEY_free(pkey); +@@ -4917,7 +5215,7 @@ + char *method =NULL; + int method_len = 0; + const EVP_CIPHER *cipher; +- EVP_CIPHER_CTX ctx; ++ EVP_CIPHER_CTX *ctx; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "szza/|s", &data, &data_len, &sealdata, &ekeys, &pubkeys, &method, &method_len) == FAILURE) { + return; +@@ -4950,6 +5248,7 @@ + memset(eks, 0, sizeof(*eks) * nkeys); + key_resources = safe_emalloc(nkeys, sizeof(long), 0); + memset(key_resources, 0, sizeof(*key_resources) * nkeys); ++ memset(pkeys, 0, sizeof(*pkeys) * nkeys); + + /* get the public keys we are using to seal this data */ + zend_hash_internal_pointer_reset_ex(pubkeysht, &pos); +@@ -4967,27 +5266,28 @@ + i++; + } + +- if (!EVP_EncryptInit(&ctx,cipher,NULL,NULL)) { ++ ctx = EVP_CIPHER_CTX_new(); ++ if (ctx == NULL || !EVP_EncryptInit(ctx,cipher,NULL,NULL)) { + RETVAL_FALSE; +- EVP_CIPHER_CTX_cleanup(&ctx); ++ EVP_CIPHER_CTX_free(ctx); + goto clean_exit; + } + + #if 0 + /* Need this if allow ciphers that require initialization vector */ +- ivlen = EVP_CIPHER_CTX_iv_length(&ctx); ++ ivlen = EVP_CIPHER_CTX_iv_length(ctx); + iv = ivlen ? emalloc(ivlen + 1) : NULL; + #endif + /* allocate one byte extra to make room for \0 */ +- buf = emalloc(data_len + EVP_CIPHER_CTX_block_size(&ctx)); +- EVP_CIPHER_CTX_cleanup(&ctx); ++ buf = emalloc(data_len + EVP_CIPHER_CTX_block_size(ctx)); ++ EVP_CIPHER_CTX_cleanup(ctx); + +- if (EVP_SealInit(&ctx, cipher, eks, eksl, NULL, pkeys, nkeys) <= 0 || +- !EVP_SealUpdate(&ctx, buf, &len1, (unsigned char *)data, data_len) || +- !EVP_SealFinal(&ctx, buf + len1, &len2)) { ++ if (EVP_SealInit(ctx, cipher, eks, eksl, NULL, pkeys, nkeys) <= 0 || ++ !EVP_SealUpdate(ctx, buf, &len1, (unsigned char *)data, data_len) || ++ !EVP_SealFinal(ctx, buf + len1, &len2)) { + RETVAL_FALSE; + efree(buf); +- EVP_CIPHER_CTX_cleanup(&ctx); ++ EVP_CIPHER_CTX_free(ctx); + goto clean_exit; + } + +@@ -5018,7 +5318,7 @@ + efree(buf); + } + RETVAL_LONG(len1 + len2); +- EVP_CIPHER_CTX_cleanup(&ctx); ++ EVP_CIPHER_CTX_free(ctx); + + clean_exit: + for (i=0; i<nkeys; i++) { +@@ -5045,7 +5345,7 @@ + int len1, len2; + unsigned char *buf; + long keyresource = -1; +- EVP_CIPHER_CTX ctx; ++ EVP_CIPHER_CTX *ctx; + char * data; int data_len; + char * ekey; int ekey_len; + char *method =NULL; +@@ -5074,8 +5374,9 @@ + + buf = emalloc(data_len + 1); + +- if (EVP_OpenInit(&ctx, cipher, (unsigned char *)ekey, ekey_len, NULL, pkey) && EVP_OpenUpdate(&ctx, buf, &len1, (unsigned char *)data, data_len)) { +- if (!EVP_OpenFinal(&ctx, buf + len1, &len2) || (len1 + len2 == 0)) { ++ ctx = EVP_CIPHER_CTX_new(); ++ if (EVP_OpenInit(ctx, cipher, (unsigned char *)ekey, ekey_len, NULL, pkey) && EVP_OpenUpdate(ctx, buf, &len1, (unsigned char *)data, data_len)) { ++ if (!EVP_OpenFinal(ctx, buf + len1, &len2) || (len1 + len2 == 0)) { + efree(buf); + RETVAL_FALSE; + } else { +@@ -5091,7 +5392,7 @@ + if (keyresource == -1) { + EVP_PKEY_free(pkey); + } +- EVP_CIPHER_CTX_cleanup(&ctx); ++ EVP_CIPHER_CTX_free(ctx); + } + /* }}} */ + +@@ -5151,7 +5452,7 @@ + char *data, *method; + int data_len, method_len; + const EVP_MD *mdtype; +- EVP_MD_CTX md_ctx; ++ EVP_MD_CTX *md_ctx; + int siglen; + unsigned char *sigbuf; + +@@ -5167,9 +5468,10 @@ + siglen = EVP_MD_size(mdtype); + sigbuf = emalloc(siglen + 1); + +- EVP_DigestInit(&md_ctx, mdtype); +- EVP_DigestUpdate(&md_ctx, (unsigned char *)data, data_len); +- if (EVP_DigestFinal (&md_ctx, (unsigned char *)sigbuf, (unsigned int *)&siglen)) { ++ md_ctx = EVP_MD_CTX_create(); ++ EVP_DigestInit(md_ctx, mdtype); ++ EVP_DigestUpdate(md_ctx, (unsigned char *)data, data_len); ++ if (EVP_DigestFinal (md_ctx, (unsigned char *)sigbuf, (unsigned int *)&siglen)) { + if (raw_output) { + sigbuf[siglen] = '\0'; + RETVAL_STRINGL((char *)sigbuf, siglen, 0); +@@ -5185,6 +5487,8 @@ + efree(sigbuf); + RETVAL_FALSE; + } ++ ++ EVP_MD_CTX_destroy(md_ctx); + } + /* }}} */ + +@@ -5230,7 +5534,7 @@ + char *data, *method, *password, *iv = ""; + int data_len, method_len, password_len, iv_len = 0, max_iv_len; + const EVP_CIPHER *cipher_type; +- EVP_CIPHER_CTX cipher_ctx; ++ EVP_CIPHER_CTX *cipher_ctx; + int i=0, outlen, keylen; + unsigned char *outbuf, *key; + zend_bool free_iv; +@@ -5262,19 +5566,24 @@ + outlen = data_len + EVP_CIPHER_block_size(cipher_type); + outbuf = safe_emalloc(outlen, 1, 1); + +- EVP_EncryptInit(&cipher_ctx, cipher_type, NULL, NULL); ++ cipher_ctx = EVP_CIPHER_CTX_new(); ++ if (!cipher_ctx) { ++ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Failed to create cipher context"); ++ RETURN_FALSE; ++ } ++ EVP_EncryptInit(cipher_ctx, cipher_type, NULL, NULL); + if (password_len > keylen) { +- EVP_CIPHER_CTX_set_key_length(&cipher_ctx, password_len); ++ EVP_CIPHER_CTX_set_key_length(cipher_ctx, password_len); + } +- EVP_EncryptInit_ex(&cipher_ctx, NULL, NULL, key, (unsigned char *)iv); ++ EVP_EncryptInit_ex(cipher_ctx, NULL, NULL, key, (unsigned char *)iv); + if (options & OPENSSL_ZERO_PADDING) { +- EVP_CIPHER_CTX_set_padding(&cipher_ctx, 0); ++ EVP_CIPHER_CTX_set_padding(cipher_ctx, 0); + } + if (data_len > 0) { +- EVP_EncryptUpdate(&cipher_ctx, outbuf, &i, (unsigned char *)data, data_len); ++ EVP_EncryptUpdate(cipher_ctx, outbuf, &i, (unsigned char *)data, data_len); + } + outlen = i; +- if (EVP_EncryptFinal(&cipher_ctx, (unsigned char *)outbuf + i, &i)) { ++ if (EVP_EncryptFinal(cipher_ctx, (unsigned char *)outbuf + i, &i)) { + outlen += i; + if (options & OPENSSL_RAW_DATA) { + outbuf[outlen] = '\0'; +@@ -5301,7 +5610,8 @@ + if (free_iv) { + efree(iv); + } +- EVP_CIPHER_CTX_cleanup(&cipher_ctx); ++ EVP_CIPHER_CTX_cleanup(cipher_ctx); ++ EVP_CIPHER_CTX_free(cipher_ctx); + } + /* }}} */ + +@@ -5313,7 +5623,7 @@ + char *data, *method, *password, *iv = ""; + int data_len, method_len, password_len, iv_len = 0; + const EVP_CIPHER *cipher_type; +- EVP_CIPHER_CTX cipher_ctx; ++ EVP_CIPHER_CTX *cipher_ctx; + int i, outlen, keylen; + unsigned char *outbuf, *key; + int base64_str_len; +@@ -5359,17 +5669,23 @@ + outlen = data_len + EVP_CIPHER_block_size(cipher_type); + outbuf = emalloc(outlen + 1); + +- EVP_DecryptInit(&cipher_ctx, cipher_type, NULL, NULL); ++ cipher_ctx = EVP_CIPHER_CTX_new(); ++ if (!cipher_ctx) { ++ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Failed to create cipher context"); ++ RETURN_FALSE; ++ } ++ ++ EVP_DecryptInit(cipher_ctx, cipher_type, NULL, NULL); + if (password_len > keylen) { +- EVP_CIPHER_CTX_set_key_length(&cipher_ctx, password_len); ++ EVP_CIPHER_CTX_set_key_length(cipher_ctx, password_len); + } +- EVP_DecryptInit_ex(&cipher_ctx, NULL, NULL, key, (unsigned char *)iv); ++ EVP_DecryptInit_ex(cipher_ctx, NULL, NULL, key, (unsigned char *)iv); + if (options & OPENSSL_ZERO_PADDING) { +- EVP_CIPHER_CTX_set_padding(&cipher_ctx, 0); ++ EVP_CIPHER_CTX_set_padding(cipher_ctx, 0); + } +- EVP_DecryptUpdate(&cipher_ctx, outbuf, &i, (unsigned char *)data, data_len); ++ EVP_DecryptUpdate(cipher_ctx, outbuf, &i, (unsigned char *)data, data_len); + outlen = i; +- if (EVP_DecryptFinal(&cipher_ctx, (unsigned char *)outbuf + i, &i)) { ++ if (EVP_DecryptFinal(cipher_ctx, (unsigned char *)outbuf + i, &i)) { + outlen += i; + outbuf[outlen] = '\0'; + RETVAL_STRINGL((char *)outbuf, outlen, 0); +@@ -5386,7 +5702,8 @@ + if (base64_str) { + efree(base64_str); + } +- EVP_CIPHER_CTX_cleanup(&cipher_ctx); ++ EVP_CIPHER_CTX_cleanup(cipher_ctx); ++ EVP_CIPHER_CTX_free(cipher_ctx); + } + /* }}} */ + +@@ -5424,6 +5741,7 @@ + zval *key; + char *pub_str; + int pub_len; ++ DH *dh; + EVP_PKEY *pkey; + BIGNUM *pub; + char *data; +@@ -5433,14 +5751,21 @@ + return; + } + ZEND_FETCH_RESOURCE(pkey, EVP_PKEY *, &key, -1, "OpenSSL key", le_key); +- if (!pkey || EVP_PKEY_type(pkey->type) != EVP_PKEY_DH || !pkey->pkey.dh) { ++ if (pkey == NULL) { ++ RETURN_FALSE; ++ } ++ if (EVP_PKEY_base_id(pkey) != EVP_PKEY_DH) { ++ RETURN_FALSE; ++ } ++ dh = EVP_PKEY_get0_DH(pkey); ++ if (dh == NULL) { + RETURN_FALSE; + } + + pub = BN_bin2bn((unsigned char*)pub_str, pub_len, NULL); + +- data = emalloc(DH_size(pkey->pkey.dh) + 1); +- len = DH_compute_key((unsigned char*)data, pub, pkey->pkey.dh); ++ data = emalloc(DH_size(dh) + 1); ++ len = DH_compute_key((unsigned char*)data, pub, dh); + + if (len >= 0) { + data[len] = 0; +diff --git a/ext/openssl/tests/bug41033.phpt b/ext/openssl/tests/bug41033.phpt +index 4aeae66..50c78fe 100644 +--- a/ext/openssl/tests/bug41033.phpt ++++ b/ext/openssl/tests/bug41033.phpt +@@ -13,11 +13,11 @@ + + $prkeyid = openssl_get_privatekey($prv, "1234"); + $ct = "Hello I am some text!"; +-openssl_sign($ct, $signature, $prkeyid, OPENSSL_ALGO_DSS1); ++openssl_sign($ct, $signature, $prkeyid, OPENSSL_VERSION_NUMBER < 0x10100000 ? OPENSSL_ALGO_DSS1 : OPENSSL_ALGO_SHA1); + echo "Signature: ".base64_encode($signature) . "\n"; + + $pukeyid = openssl_get_publickey($pub); +-$valid = openssl_verify($ct, $signature, $pukeyid, OPENSSL_ALGO_DSS1); ++$valid = openssl_verify($ct, $signature, $pukeyid, OPENSSL_VERSION_NUMBER < 0x10100000 ? OPENSSL_ALGO_DSS1 : OPENSSL_ALGO_SHA1); + echo "Signature validity: " . $valid . "\n"; + + +diff --git a/ext/openssl/tests/bug66501.phpt b/ext/openssl/tests/bug66501.phpt +index 7ad5e21..c2146ab 100644 +--- a/ext/openssl/tests/bug66501.phpt ++++ b/ext/openssl/tests/bug66501.phpt +@@ -16,7 +16,7 @@ + sqOTOnMoezkbSmVVMuwz9flvnqHGmQvmug==
+ -----END EC PRIVATE KEY-----';
+ $key = openssl_pkey_get_private($pkey);
+-$res = openssl_sign($data ='alpha', $sign, $key, 'ecdsa-with-SHA1');
++$res = openssl_sign($data ='alpha', $sign, $key, OPENSSL_VERSION_NUMBER < 0x10100000 ? 'ecdsa-with-SHA1' : 'SHA1');
+ var_dump($res);
+ --EXPECTF--
+ bool(true)
+diff --git a/ext/openssl/tests/openssl_error_string_basic.phpt b/ext/openssl/tests/openssl_error_string_basic.phpt +index 82f3099..d94048d 100644 +--- a/ext/openssl/tests/openssl_error_string_basic.phpt ++++ b/ext/openssl/tests/openssl_error_string_basic.phpt +@@ -105,7 +105,7 @@ + // public encrypt and decrypt with failed padding check and padding + @openssl_public_encrypt("data", $crypted, $public_key_file, 1000); + @openssl_public_decrypt("data", $crypted, $public_key_file); +-expect_openssl_errors('openssl_private_(en|de)crypt padding', ['0906D06C', '04068076', '0407006A', '04067072']); ++expect_openssl_errors('openssl_private_(en|de)crypt padding', OPENSSL_VERSION_NUMBER < 0x10100000 ? ['0906D06C', '04068076', '0407006A', '04067072'] : ['0906D06C', '04068076', '04067072']); + + // X509 + echo "X509 errors\n"; +diff --git a/ext/openssl/tests/sni_server.phpt b/ext/openssl/tests/sni_server.phpt +index d44a69f..ef23258 100644 +--- a/ext/openssl/tests/sni_server.phpt ++++ b/ext/openssl/tests/sni_server.phpt +@@ -27,6 +27,9 @@ + $clientCode = <<<'CODE' + $flags = STREAM_CLIENT_CONNECT; + $ctxArr = [ ++ 'verify_peer' => false, ++ 'verify_peer_name' => false, ++ 'allow_self_signed' => true, + 'cafile' => __DIR__ . '/sni_server_ca.pem', + 'capture_peer_cert' => true + ]; +diff --git a/ext/openssl/xp_ssl.c b/ext/openssl/xp_ssl.c +index d549033..c2d477c 100644 +--- a/ext/openssl/xp_ssl.c ++++ b/ext/openssl/xp_ssl.c +@@ -935,7 +935,7 @@ + static const SSL_METHOD *php_select_crypto_method(long method_value, int is_client TSRMLS_DC) /* {{{ */ + { + if (method_value == STREAM_CRYPTO_METHOD_SSLv2) { +-#ifndef OPENSSL_NO_SSL2 ++#if !defined(OPENSSL_NO_SSL2) && OPENSSL_VERSION_NUMBER < 0x10100000L + return is_client ? SSLv2_client_method() : SSLv2_server_method(); + #else + php_error_docref(NULL TSRMLS_CC, E_WARNING, +@@ -1588,12 +1588,26 @@ + } + /* }}} */ + ++#define PHP_SSL_MAX_VERSION_LEN 32 ++ ++static char *php_ssl_cipher_get_version(const SSL_CIPHER *c, char *buffer, size_t max_len) /* {{{ */ ++{ ++ const char *version = SSL_CIPHER_get_version(c); ++ strncpy(buffer, version, max_len); ++ if (max_len <= strlen(version)) { ++ buffer[max_len - 1] = 0; ++ } ++ return buffer; ++} ++/* }}} */ ++ + static zval *capture_session_meta(SSL *ssl_handle) /* {{{ */ + { + zval *meta_arr; + char *proto_str; + long proto = SSL_version(ssl_handle); + const SSL_CIPHER *cipher = SSL_get_current_cipher(ssl_handle); ++ char version_str[PHP_SSL_MAX_VERSION_LEN]; + + switch (proto) { + #if OPENSSL_VERSION_NUMBER >= 0x10001001L +@@ -1611,7 +1625,7 @@ + add_assoc_string(meta_arr, "protocol", proto_str, 1); + add_assoc_string(meta_arr, "cipher_name", (char *) SSL_CIPHER_get_name(cipher), 1); + add_assoc_long(meta_arr, "cipher_bits", SSL_CIPHER_get_bits(cipher, NULL)); +- add_assoc_string(meta_arr, "cipher_version", SSL_CIPHER_get_version(cipher), 1); ++ add_assoc_string(meta_arr, "cipher_version", php_ssl_cipher_get_version(cipher, version_str, PHP_SSL_MAX_VERSION_LEN), 1); + + return meta_arr; + } +diff --git a/ext/phar/util.c b/ext/phar/util.c +index 828be8f..06e4e55 100644 +--- a/ext/phar/util.c ++++ b/ext/phar/util.c +@@ -1531,7 +1531,7 @@ + BIO *in; + EVP_PKEY *key; + EVP_MD *mdtype = (EVP_MD *) EVP_sha1(); +- EVP_MD_CTX md_ctx; ++ EVP_MD_CTX *md_ctx; + #else + int tempsig; + #endif +@@ -1608,7 +1608,8 @@ + return FAILURE; + } + +- EVP_VerifyInit(&md_ctx, mdtype); ++ md_ctx = EVP_MD_CTX_create(); ++ EVP_VerifyInit(md_ctx, mdtype); + read_len = end_of_phar; + + if (read_len > sizeof(buf)) { +@@ -1620,7 +1621,7 @@ + php_stream_seek(fp, 0, SEEK_SET); + + while (read_size && (len = php_stream_read(fp, (char*)buf, read_size)) > 0) { +- EVP_VerifyUpdate (&md_ctx, buf, len); ++ EVP_VerifyUpdate (md_ctx, buf, len); + read_len -= (off_t)len; + + if (read_len < read_size) { +@@ -1628,9 +1629,9 @@ + } + } + +- if (EVP_VerifyFinal(&md_ctx, (unsigned char *)sig, sig_len, key) != 1) { ++ if (EVP_VerifyFinal(md_ctx, (unsigned char *)sig, sig_len, key) != 1) { + /* 1: signature verified, 0: signature does not match, -1: failed signature operation */ +- EVP_MD_CTX_cleanup(&md_ctx); ++ EVP_MD_CTX_destroy(md_ctx); + + if (error) { + spprintf(error, 0, "broken openssl signature"); +@@ -1639,7 +1640,7 @@ + return FAILURE; + } + +- EVP_MD_CTX_cleanup(&md_ctx); ++ EVP_MD_CTX_destroy(md_ctx); + #endif + + *signature_len = phar_hex_str((const char*)sig, sig_len, signature TSRMLS_CC); diff --git a/openssl-sslv3-consts.patch b/openssl-sslv3-consts.patch new file mode 100644 index 000000000000..f8075216683b --- /dev/null +++ b/openssl-sslv3-consts.patch @@ -0,0 +1,12 @@ +--- a/ext/openssl/openssl.c ++++ b/ext/openssl/openssl.c +@@ -1482,7 +1482,9 @@ + REGISTER_LONG_CONSTANT("PKCS7_NOSIGS", PKCS7_NOSIGS, CONST_CS|CONST_PERSISTENT); + + REGISTER_LONG_CONSTANT("OPENSSL_PKCS1_PADDING", RSA_PKCS1_PADDING, CONST_CS|CONST_PERSISTENT); ++#ifdef RSA_SSLV23_PADDING + REGISTER_LONG_CONSTANT("OPENSSL_SSLV23_PADDING", RSA_SSLV23_PADDING, CONST_CS|CONST_PERSISTENT); ++#endif + REGISTER_LONG_CONSTANT("OPENSSL_NO_PADDING", RSA_NO_PADDING, CONST_CS|CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("OPENSSL_PKCS1_OAEP_PADDING", RSA_PKCS1_OAEP_PADDING, CONST_CS|CONST_PERSISTENT); + diff --git a/pear-config-patcher.php b/pear-config-patcher.php new file mode 100644 index 000000000000..ac6a1254282b --- /dev/null +++ b/pear-config-patcher.php @@ -0,0 +1,42 @@ +<?php +if (!isset($argv, $argc)) { + echo "No command line args provided\n"; + exit(1); +} +if ($argc < 3) { + echo "Not all command line args provided\n"; + exit(2); +} +$targetFile = $confFile = $argv[1]; +$varPath = $argv[2]; + +$data = ''; +$file = fopen($confFile, "r"); + +if ($file !== false) { + while(!feof($file)) { + $line = fgets($file); + $serialized = @unserialize($line); + if (is_array($serialized)) { + $serialized['temp_dir'] = "{$varPath}/temp"; + $serialized['cache_dir'] = "{$varPath}/cache"; + $serialized['download_dir'] = "{$varPath}/download"; + $serialized['metadata_dir'] = "{$varPath}/metadata"; + $data .= @serialize($serialized); + $data .= "\n"; + } else { + $data .= $line; + } + } + fclose($file); + if (false !== file_put_contents($targetFile, $data)) { + echo "Written to $targetFile\n"; + } else { + echo "Failed to write to $targetFile\n"; + exit(3); + } +} else { + echo "File was not found {$confFile}\n"; + exit(4); +} +exit(0); diff --git a/php-apache.conf b/php-apache.conf new file mode 100644 index 000000000000..e74ae8d9b7a8 --- /dev/null +++ b/php-apache.conf @@ -0,0 +1,13 @@ +# Required modules: dir_module, @MODULE@ + +<IfModule dir_module> + <IfModule @MODULE@> + DirectoryIndex index.php index.html + <FilesMatch "\.php$"> + SetHandler application/x-httpd-php + </FilesMatch> + <FilesMatch "\.phps$"> + SetHandler application/x-httpd-php-source + </FilesMatch> + </IfModule> +</IfModule> diff --git a/php-apache.install b/php-apache.install deleted file mode 100644 index c9b669157af0..000000000000 --- a/php-apache.install +++ /dev/null @@ -1,11 +0,0 @@ -post_install() { - echo "You will need to add the following line after the existing LoadModule instructions in /etc/httpd/conf/httpd.conf :" - echo "LoadModule php5_module modules/libphp56.so" - echo - echo "Additionally, include this line at the end of /etc/httpd/conf/httpd.conf if you want .php files to be handled by php 5.6 :" - echo "Include conf/extra/php56_module.conf" - echo - echo "Be aware that ONLY A SINGLE PHP MODULE can be loaded into an Apache instance." - echo "If you want php 5 and php 7 to cohabitate, you'll have to use another method such as php-fpm, fcgi or cgi for the other PHP version." -} - diff --git a/php-enchant-depr.patch b/php-enchant-depr.patch new file mode 100644 index 000000000000..0e2d2c0cf676 --- /dev/null +++ b/php-enchant-depr.patch @@ -0,0 +1,38 @@ +--- php-7.2.1/ext/enchant/enchant.c.orig ++++ php-7.2.1/ext/enchant/enchant.c +@@ -741,7 +741,7 @@ + for (i = 0; i < n_sugg; i++) { + add_next_index_string(sugg, suggs[i]); + } +- enchant_dict_free_suggestions(pdict->pdict, suggs); ++ enchant_dict_free_string_list(pdict->pdict, suggs); + } + + +@@ -798,7 +798,7 @@ + add_next_index_string(return_value, suggs[i]); + } + +- enchant_dict_free_suggestions(pdict->pdict, suggs); ++ enchant_dict_free_string_list(pdict->pdict, suggs); + } + } + /* }}} */ +@@ -818,7 +818,7 @@ + + PHP_ENCHANT_GET_DICT; + +- enchant_dict_add_to_personal(pdict->pdict, word, wordlen); ++ enchant_dict_add(pdict->pdict, word, wordlen); + } + /* }}} */ + +@@ -856,7 +856,7 @@ + + PHP_ENCHANT_GET_DICT; + +- RETURN_BOOL(enchant_dict_is_in_session(pdict->pdict, word, wordlen)); ++ RETURN_BOOL(enchant_dict_is_added(pdict->pdict, word, wordlen)); + } + /* }}} */ + diff --git a/php-enchant-php5.3.patch b/php-enchant-php5.3.patch new file mode 100644 index 000000000000..b82eef7fdd91 --- /dev/null +++ b/php-enchant-php5.3.patch @@ -0,0 +1,23 @@ +--- a/ext/enchant/config.m4 ++++ b/ext/enchant/config.m4 +@@ -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, + [ diff --git a/php-fpm.conf.in.patch b/php-fpm.conf.in.patch deleted file mode 100644 index 9b383cbf0c90..000000000000 --- a/php-fpm.conf.in.patch +++ /dev/null @@ -1,52 +0,0 @@ ---- sapi/fpm/php-fpm.conf.in 2015-01-21 01:40:37.000000000 +0100 -+++ sapi/fpm/php-fpm.conf.in 2015-01-22 16:22:09.076969777 +0100 -@@ -12,7 +12,7 @@ - ; Relative path can also be used. They will be prefixed by: - ; - the global prefix if it's been set (-p argument) - ; - @prefix@ otherwise --;include=etc/fpm.d/*.conf -+;include=/etc/php56/fpm.d/*.conf - - ;;;;;;;;;;;;;;;;;; - ; Global Options ; -@@ -22,7 +22,7 @@ - ; Pid file - ; Note: the default prefix is @EXPANDED_LOCALSTATEDIR@ - ; Default Value: none --;pid = run/php-fpm.pid -+pid = /run/php56-fpm/php-fpm.pid - - ; Error log file - ; If it's set to "syslog", log is sent to syslogd instead of being written -@@ -161,7 +161,8 @@ - ; (IPv6 and IPv4-mapped) on a specific port; - ; '/path/to/unix/socket' - to listen on a unix socket. - ; Note: This value is mandatory. --listen = 127.0.0.1:9000 -+;listen = 127.0.0.1:9001 -+listen = /run/php56-fpm/php-fpm.sock - - ; Set listen(2) backlog. - ; Default Value: 65535 (-1 on FreeBSD and OpenBSD) -@@ -172,9 +173,9 @@ - ; BSD-derived systems allow connections regardless of permissions. - ; Default Values: user and group are set as the running user - ; mode is set to 0660 --;listen.owner = @php_fpm_user@ --;listen.group = @php_fpm_group@ --;listen.mode = 0660 -+listen.owner = @php_fpm_user@ -+listen.group = @php_fpm_group@ -+listen.mode = 0660 - ; When POSIX Access Control Lists are supported you can set them using - ; these options, value is a comma separated list of user/group names. - ; When set, listen.owner and listen.group are ignored -@@ -476,7 +477,7 @@ - ; Chdir to this directory at the start. - ; Note: relative path can be used. - ; Default Value: current directory or / when chroot --;chdir = /var/www -+;chdir = /srv/http - - ; Redirect worker stdout and stderr into main error log. If not set, stdout and - ; stderr will be redirected to /dev/null according to FastCGI specs. diff --git a/php-fpm.install b/php-fpm.install index 1e2c2d9fe0fd..90fa868cd1da 100644 --- a/php-fpm.install +++ b/php-fpm.install @@ -1,9 +1,31 @@ +pre_install() { + echo "php-fpm pre_install hook" + echo "1=$1" +} + post_install() { - if [[ ! -d run/php56-fpm ]]; then - usr/bin/systemd-tmpfiles --create php56-fpm.conf - fi + echo "php-fpm post_install hook" + echo "1=$1" +} + +pre_upgrade() { + echo "php-fpm pre_upgrade hook" + echo "1=$1" + echo "2=$2" } post_upgrade() { - post_install + echo "php-fpm post_upgrade hook" + echo "1=$1" + echo "2=$2" +} + +pre_remove() { + echo "php-fpm pre_remove hook" + echo "1=$1" +} + +post_remove() { + echo "php-fpm post_remove hook" + echo "1=$1" } diff --git a/php-fpm.service b/php-fpm.service deleted file mode 100644 index 8afb974627a5..000000000000 --- a/php-fpm.service +++ /dev/null @@ -1,13 +0,0 @@ -[Unit] -Description=The PHP 5.6 FastCGI Process Manager -After=syslog.target network.target - -[Service] -Type=notify -PIDFile=/run/php56-fpm/php-fpm.pid -PrivateTmp=true -ExecStart=/usr/bin/php56-fpm --nodaemonize --pid /run/php56-fpm/php-fpm.pid -ExecReload=/bin/kill -USR2 $MAINPID - -[Install] -WantedBy=multi-user.target diff --git a/php-fpm.tmpfiles b/php-fpm.tmpfiles deleted file mode 100644 index 0498d8844264..000000000000 --- a/php-fpm.tmpfiles +++ /dev/null @@ -1 +0,0 @@ -d /run/php56-fpm 755 root root diff --git a/php-freetype-2.9.1.patch b/php-freetype-2.9.1.patch index 02dfd9ce3cd4..506c4f0b036b 100644 --- a/php-freetype-2.9.1.patch +++ b/php-freetype-2.9.1.patch @@ -1,5 +1,5 @@ ---- a/ext/gd/config.m4 2018-04-24 11:09:54.000000000 -0400 -+++ b/ext/gd/config.m4 2018-05-04 15:18:49.867283889 -0400 +--- a/ext/gd/config.m4 ++++ b/ext/gd/config.m4 @@ -186,21 +186,36 @@ AC_DEFUN([PHP_GD_FREETYPE2],[ if test "$PHP_FREETYPE_DIR" != "no"; then @@ -48,186 +48,3 @@ PHP_EVAL_INCLINE($FREETYPE2_CFLAGS) PHP_EVAL_LIBLINE($FREETYPE2_LIBS, GD_SHARED_LIBADD) AC_DEFINE(HAVE_LIBFREETYPE,1,[ ]) ---- a/configure 2018-04-24 11:10:05.000000000 -0400 -+++ b/configure 2018-05-04 15:18:45.626367913 -0400 -@@ -34348,21 +34348,79 @@ - - if test "$PHP_FREETYPE_DIR" != "no"; then - -- for i in $PHP_FREETYPE_DIR /usr/local /usr; do -- if test -f "$i/bin/freetype-config"; then -- FREETYPE2_DIR=$i -- FREETYPE2_CONFIG="$i/bin/freetype-config" -- break -+ # Extract the first word of "pkg-config", so it can be a program name with args. -+set dummy pkg-config; ac_word=$2 -+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -+$as_echo_n "checking for $ac_word... " >&6; } -+if ${ac_cv_path_PKG_CONFIG+:} false; then : -+ $as_echo_n "(cached) " >&6 -+else -+ case $PKG_CONFIG in -+ [\\/]* | ?:[\\/]*) -+ ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path. -+ ;; -+ *) -+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -+for as_dir in $PATH -+do -+ IFS=$as_save_IFS -+ test -z "$as_dir" && as_dir=. -+ for ac_exec_ext in '' $ac_executable_extensions; do -+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then -+ ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" -+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 -+ break 2 -+ fi -+done -+ done -+IFS=$as_save_IFS -+ -+ test -z "$ac_cv_path_PKG_CONFIG" && ac_cv_path_PKG_CONFIG="no" -+ ;; -+esac -+fi -+PKG_CONFIG=$ac_cv_path_PKG_CONFIG -+if test -n "$PKG_CONFIG"; then -+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5 -+$as_echo "$PKG_CONFIG" >&6; } -+else -+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -+$as_echo "no" >&6; } -+fi -+ -+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for freetype2" >&5 -+$as_echo_n "checking for freetype2... " >&6; } -+ -+ -+ if test -x "$PKG_CONFIG" && $PKG_CONFIG --exists freetype2 ; then -+ -+ FREETYPE2_CFLAGS=`$PKG_CONFIG --cflags freetype2` -+ FREETYPE2_LIBS=`$PKG_CONFIG --libs freetype2` -+ FREETYPE2_VERSION=`$PKG_CONFIG --modversion freetype2` -+ FREETYPE2_DIR="found" -+ -+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: from pkgconfig: version $FREETYPE2_VERSION found" >&5 -+$as_echo "from pkgconfig: version $FREETYPE2_VERSION found" >&6; } -+ else -+ -+ for i in $PHP_FREETYPE_DIR /usr/local /usr; do -+ if test -f "$i/bin/freetype-config"; then -+ FREETYPE2_DIR=$i -+ FREETYPE2_CONFIG="$i/bin/freetype-config" -+ break -+ fi -+ done -+ -+ if test -z "$FREETYPE2_DIR"; then -+ as_fn_error $? "freetype-config not found." "$LINENO" 5 - fi -- done - -- if test -z "$FREETYPE2_DIR"; then -- as_fn_error $? "freetype-config not found." "$LINENO" 5 -+ FREETYPE2_CFLAGS=`$FREETYPE2_CONFIG --cflags` -+ FREETYPE2_LIBS=`$FREETYPE2_CONFIG --libs` -+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: found via freetype-config" >&5 -+$as_echo "found via freetype-config" >&6; } - fi - -- FREETYPE2_CFLAGS=`$FREETYPE2_CONFIG --cflags` -- FREETYPE2_LIBS=`$FREETYPE2_CONFIG --libs` -- - - for ac_i in $FREETYPE2_CFLAGS; do - case $ac_i in -@@ -36019,21 +36076,78 @@ - - if test "$PHP_FREETYPE_DIR" != "no"; then - -- for i in $PHP_FREETYPE_DIR /usr/local /usr; do -- if test -f "$i/bin/freetype-config"; then -- FREETYPE2_DIR=$i -- FREETYPE2_CONFIG="$i/bin/freetype-config" -- break -+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for freetype2" >&5 -+$as_echo_n "checking for freetype2... " >&6; } -+ # Extract the first word of "pkg-config", so it can be a program name with args. -+set dummy pkg-config; ac_word=$2 -+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -+$as_echo_n "checking for $ac_word... " >&6; } -+if ${ac_cv_path_PKG_CONFIG+:} false; then : -+ $as_echo_n "(cached) " >&6 -+else -+ case $PKG_CONFIG in -+ [\\/]* | ?:[\\/]*) -+ ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path. -+ ;; -+ *) -+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -+for as_dir in $PATH -+do -+ IFS=$as_save_IFS -+ test -z "$as_dir" && as_dir=. -+ for ac_exec_ext in '' $ac_executable_extensions; do -+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then -+ ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" -+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 -+ break 2 -+ fi -+done -+ done -+IFS=$as_save_IFS -+ -+ test -z "$ac_cv_path_PKG_CONFIG" && ac_cv_path_PKG_CONFIG="no" -+ ;; -+esac -+fi -+PKG_CONFIG=$ac_cv_path_PKG_CONFIG -+if test -n "$PKG_CONFIG"; then -+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5 -+$as_echo "$PKG_CONFIG" >&6; } -+else -+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -+$as_echo "no" >&6; } -+fi -+ -+ -+ -+ if test -x "$PKG_CONFIG" && $PKG_CONFIG --exists freetype2 ; then -+ -+ FREETYPE2_CFLAGS=`$PKG_CONFIG --cflags freetype2` -+ FREETYPE2_LIBS=`$PKG_CONFIG --libs freetype2` -+ FREETYPE2_VERSION=`$PKG_CONFIG --modversion freetype2` -+ -+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: from pkgconfig: version $FREETYPE_VERSON found" >&5 -+$as_echo "from pkgconfig: version $FREETYPE_VERSON found" >&6; } -+ else -+ -+ for i in $PHP_FREETYPE_DIR /usr/local /usr; do -+ if test -f "$i/bin/freetype-config"; then -+ FREETYPE2_DIR=$i -+ FREETYPE2_CONFIG="$i/bin/freetype-config" -+ break -+ fi -+ done -+ -+ if test -z "$FREETYPE2_DIR"; then -+ as_fn_error $? "freetype-config not found." "$LINENO" 5 - fi -- done - -- if test -z "$FREETYPE2_DIR"; then -- as_fn_error $? "freetype-config not found." "$LINENO" 5 -+ FREETYPE2_CFLAGS=`$FREETYPE2_CONFIG --cflags` -+ FREETYPE2_LIBS=`$FREETYPE2_CONFIG --libs` -+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: found via freetype-config" >&5 -+$as_echo "found via freetype-config" >&6; } - fi - -- FREETYPE2_CFLAGS=`$FREETYPE2_CONFIG --cflags` -- FREETYPE2_LIBS=`$FREETYPE2_CONFIG --libs` -- - - for ac_i in $FREETYPE2_CFLAGS; do - case $ac_i in diff --git a/php-icu-php5.5.patch b/php-icu-php5.5.patch new file mode 100644 index 000000000000..4dde37a4c30e --- /dev/null +++ b/php-icu-php5.5.patch @@ -0,0 +1,40 @@ +--- a/ext/intl/breakiterator/codepointiterator_internal.cpp ++++ b/ext/intl/breakiterator/codepointiterator_internal.cpp +@@ -74,7 +74,11 @@ + clearCurrentCharIter(); + } + ++#if U_ICU_VERSION_MAJOR_NUM >= 70 ++bool CodePointBreakIterator::operator==(const BreakIterator& that) const ++#else + UBool CodePointBreakIterator::operator==(const BreakIterator& that) const ++#endif + { + if (typeid(*this) != typeid(that)) { + return FALSE; +--- 7.2.34/ext/intl/breakiterator/codepointiterator_internal.h ++++ 7.2.34/ext/intl/breakiterator/codepointiterator_internal.h +@@ -36,8 +36,11 @@ + + virtual ~CodePointBreakIterator(); + ++#if U_ICU_VERSION_MAJOR_NUM >= 70 ++ virtual bool operator==(const BreakIterator& that) const; ++#else + virtual UBool operator==(const BreakIterator& that) const; +- ++#endif + virtual CodePointBreakIterator* clone(void) const; + + virtual UClassID getDynamicClassID(void) const; +--- a/ext/intl/locale/locale_methods.c ++++ b/ext/intl/locale/locale_methods.c +@@ -1333,7 +1333,7 @@ + if( token && (token==cur_lang_tag) ){ + /* check if the char. after match is SEPARATOR */ + chrcheck = token + (strlen(cur_loc_range)); +- if( isIDSeparator(*chrcheck) || isEndOfTag(*chrcheck) ){ ++ if( isIDSeparator(*chrcheck) || isKeywordSeparator(*chrcheck) || isEndOfTag(*chrcheck) ){ + if( cur_lang_tag){ + efree( cur_lang_tag ); + } diff --git a/php-makefile-patcher.php b/php-makefile-patcher.php new file mode 100644 index 000000000000..7a071eeba66d --- /dev/null +++ b/php-makefile-patcher.php @@ -0,0 +1,47 @@ +<?php +if (!isset($argv, $argc)) { + echo "No command line args provided\n"; + exit(1); +} +if ($argc < 2) { + echo "Not all command line args provided\n"; + exit(2); +} +$filename = $argv[1]; +$fileContent = @file_get_contents($filename); +if (!strlen($fileContent)) { + echo "No file contents of $filename\n"; + exit(3); +} +$matches = array(); +$match = preg_match("/^(?P<line>(?P<definition>PHP_MODULES[\s\t]+=[\s\t]+)(?P<expression>.*)$)/m", $fileContent, $matches); +if (!$match) { + echo "No PHP_MODULES in $filename\n"; + exit (4); +} +$expression = explode(' ', $matches['expression']); +function sortByPrio($a, $b) { + $aPrio = 999; + $bPrio = 999; + $priorities = array('/openssl/i'=> 0, '@\/xml\.@i'=>1, '@\/pdo\.@i'=>2, '@\/dom\.@i'=>3, '/mysqlnd/i'=>4); + foreach ($priorities as $regex => $prio) { + if (preg_match($regex, $a) && $prio < $aPrio) { + $aPrio = $prio; + } + if (preg_match($regex, $b) && $prio < $bPrio) { + $bPrio = $prio; + } + } + if ($aPrio == $bPrio) { + return 0; + } + return $aPrio > $bPrio ? 1: -1; +} +usort($expression, 'sortByPrio'); +$expression = $matches['definition'].join (' ', $expression)."\n"; +$fileContent = str_replace($matches['line'], $expression, $fileContent); +if (!file_put_contents($filename, $fileContent)) { + echo "Failed to write to $filename\n"; + exit(5); +} +exit(0); diff --git a/php-mysqlnd-charsets.patch b/php-mysqlnd-charsets.patch new file mode 100644 index 000000000000..e2e7bf6bc110 --- /dev/null +++ b/php-mysqlnd-charsets.patch @@ -0,0 +1,58 @@ +diff --git a/ext/mysqlnd/mysqlnd_charset.c b/ext/mysqlnd/mysqlnd_charset.c +index 5983b2d..c728452 100644 +--- a/ext/mysqlnd/mysqlnd_charset.c ++++ b/ext/mysqlnd/mysqlnd_charset.c +@@ -687,6 +687,53 @@ + { 249, "gb18030", "gb18030_bin", 1, 4, "", mysqlnd_mbcharlen_gb18030, my_ismbchar_gb18030}, + + { 254, UTF8_MB3, UTF8_MB3"_general_cs", 1, 3, "", mysqlnd_mbcharlen_utf8, check_mb_utf8_valid}, ++ { 255, UTF8_MB4, UTF8_MB4"_0900_ai_ci", 1, 4, "", mysqlnd_mbcharlen_utf8, check_mb_utf8_valid}, ++ { 256, UTF8_MB4, UTF8_MB4"_de_pb_0900_ai_ci", 1, 4, "", mysqlnd_mbcharlen_utf8, check_mb_utf8_valid}, ++ { 257, UTF8_MB4, UTF8_MB4"_is_0900_ai_ci", 1, 4, "", mysqlnd_mbcharlen_utf8, check_mb_utf8_valid}, ++ { 258, UTF8_MB4, UTF8_MB4"_lv_0900_ai_ci", 1, 4, "", mysqlnd_mbcharlen_utf8, check_mb_utf8_valid}, ++ { 259, UTF8_MB4, UTF8_MB4"_ro_0900_ai_ci", 1, 4, "", mysqlnd_mbcharlen_utf8, check_mb_utf8_valid}, ++ { 260, UTF8_MB4, UTF8_MB4"_sl_0900_ai_ci", 1, 4, "", mysqlnd_mbcharlen_utf8, check_mb_utf8_valid}, ++ { 261, UTF8_MB4, UTF8_MB4"_pl_0900_ai_ci", 1, 4, "", mysqlnd_mbcharlen_utf8, check_mb_utf8_valid}, ++ { 262, UTF8_MB4, UTF8_MB4"_et_0900_ai_ci", 1, 4, "", mysqlnd_mbcharlen_utf8, check_mb_utf8_valid}, ++ { 263, UTF8_MB4, UTF8_MB4"_es_0900_ai_ci", 1, 4, "", mysqlnd_mbcharlen_utf8, check_mb_utf8_valid}, ++ { 264, UTF8_MB4, UTF8_MB4"_sv_0900_ai_ci", 1, 4, "", mysqlnd_mbcharlen_utf8, check_mb_utf8_valid}, ++ { 265, UTF8_MB4, UTF8_MB4"_tr_0900_ai_ci", 1, 4, "", mysqlnd_mbcharlen_utf8, check_mb_utf8_valid}, ++ { 266, UTF8_MB4, UTF8_MB4"_cs_0900_ai_ci", 1, 4, "", mysqlnd_mbcharlen_utf8, check_mb_utf8_valid}, ++ { 267, UTF8_MB4, UTF8_MB4"_da_0900_ai_ci", 1, 4, "", mysqlnd_mbcharlen_utf8, check_mb_utf8_valid}, ++ { 268, UTF8_MB4, UTF8_MB4"_lt_0900_ai_ci", 1, 4, "", mysqlnd_mbcharlen_utf8, check_mb_utf8_valid}, ++ { 269, UTF8_MB4, UTF8_MB4"_sk_0900_ai_ci", 1, 4, "", mysqlnd_mbcharlen_utf8, check_mb_utf8_valid}, ++ { 270, UTF8_MB4, UTF8_MB4"_es_trad_0900_ai_ci", 1, 4, "", mysqlnd_mbcharlen_utf8, check_mb_utf8_valid}, ++ { 271, UTF8_MB4, UTF8_MB4"_la_0900_ai_ci", 1, 4, "", mysqlnd_mbcharlen_utf8, check_mb_utf8_valid}, ++ { 272, UTF8_MB4, UTF8_MB4"_fa_0900_ai_ci", 1, 4, "", mysqlnd_mbcharlen_utf8, check_mb_utf8_valid}, ++ { 273, UTF8_MB4, UTF8_MB4"_eo_0900_ai_ci", 1, 4, "", mysqlnd_mbcharlen_utf8, check_mb_utf8_valid}, ++ { 274, UTF8_MB4, UTF8_MB4"_hu_0900_ai_ci", 1, 4, "", mysqlnd_mbcharlen_utf8, check_mb_utf8_valid}, ++ { 275, UTF8_MB4, UTF8_MB4"_hr_0900_ai_ci", 1, 4, "", mysqlnd_mbcharlen_utf8, check_mb_utf8_valid}, ++ { 276, UTF8_MB4, UTF8_MB4"_si_0900_ai_ci", 1, 4, "", mysqlnd_mbcharlen_utf8, check_mb_utf8_valid}, ++ { 277, UTF8_MB4, UTF8_MB4"_vi_0900_ai_ci", 1, 4, "", mysqlnd_mbcharlen_utf8, check_mb_utf8_valid}, ++ { 278, UTF8_MB4, UTF8_MB4"_0900_as_cs", 1, 4, "", mysqlnd_mbcharlen_utf8, check_mb_utf8_valid}, ++ { 279, UTF8_MB4, UTF8_MB4"_de_pb_0900_as_cs", 1, 4, "", mysqlnd_mbcharlen_utf8, check_mb_utf8_valid}, ++ { 280, UTF8_MB4, UTF8_MB4"_is_0900_as_cs", 1, 4, "", mysqlnd_mbcharlen_utf8, check_mb_utf8_valid}, ++ { 281, UTF8_MB4, UTF8_MB4"_lv_0900_as_cs", 1, 4, "", mysqlnd_mbcharlen_utf8, check_mb_utf8_valid}, ++ { 282, UTF8_MB4, UTF8_MB4"_ro_0900_as_cs", 1, 4, "", mysqlnd_mbcharlen_utf8, check_mb_utf8_valid}, ++ { 283, UTF8_MB4, UTF8_MB4"_sl_0900_as_cs", 1, 4, "", mysqlnd_mbcharlen_utf8, check_mb_utf8_valid}, ++ { 284, UTF8_MB4, UTF8_MB4"_pl_0900_as_cs", 1, 4, "", mysqlnd_mbcharlen_utf8, check_mb_utf8_valid}, ++ { 285, UTF8_MB4, UTF8_MB4"_et_0900_as_cs", 1, 4, "", mysqlnd_mbcharlen_utf8, check_mb_utf8_valid}, ++ { 286, UTF8_MB4, UTF8_MB4"_es_0900_as_cs", 1, 4, "", mysqlnd_mbcharlen_utf8, check_mb_utf8_valid}, ++ { 287, UTF8_MB4, UTF8_MB4"_sv_0900_as_cs", 1, 4, "", mysqlnd_mbcharlen_utf8, check_mb_utf8_valid}, ++ { 288, UTF8_MB4, UTF8_MB4"_tr_0900_as_cs", 1, 4, "", mysqlnd_mbcharlen_utf8, check_mb_utf8_valid}, ++ { 289, UTF8_MB4, UTF8_MB4"_cs_0900_as_cs", 1, 4, "", mysqlnd_mbcharlen_utf8, check_mb_utf8_valid}, ++ { 290, UTF8_MB4, UTF8_MB4"_da_0900_as_cs", 1, 4, "", mysqlnd_mbcharlen_utf8, check_mb_utf8_valid}, ++ { 291, UTF8_MB4, UTF8_MB4"_lt_0900_as_cs", 1, 4, "", mysqlnd_mbcharlen_utf8, check_mb_utf8_valid}, ++ { 292, UTF8_MB4, UTF8_MB4"_sk_0900_as_cs", 1, 4, "", mysqlnd_mbcharlen_utf8, check_mb_utf8_valid}, ++ { 293, UTF8_MB4, UTF8_MB4"_es_trad_0900_as_cs", 1, 4, "", mysqlnd_mbcharlen_utf8, check_mb_utf8_valid}, ++ { 294, UTF8_MB4, UTF8_MB4"_la_0900_as_cs", 1, 4, "", mysqlnd_mbcharlen_utf8, check_mb_utf8_valid}, ++ { 295, UTF8_MB4, UTF8_MB4"_fa_0900_as_cs", 1, 4, "", mysqlnd_mbcharlen_utf8, check_mb_utf8_valid}, ++ { 296, UTF8_MB4, UTF8_MB4"_eo_0900_as_cs", 1, 4, "", mysqlnd_mbcharlen_utf8, check_mb_utf8_valid}, ++ { 297, UTF8_MB4, UTF8_MB4"_hu_0900_as_cs", 1, 4, "", mysqlnd_mbcharlen_utf8, check_mb_utf8_valid}, ++ { 298, UTF8_MB4, UTF8_MB4"_hr_0900_as_cs", 1, 4, "", mysqlnd_mbcharlen_utf8, check_mb_utf8_valid}, ++ { 299, UTF8_MB4, UTF8_MB4"_si_0900_as_cs", 1, 4, "", mysqlnd_mbcharlen_utf8, check_mb_utf8_valid}, ++ { 300, UTF8_MB4, UTF8_MB4"_vi_0900_as_cs", 1, 4, "", mysqlnd_mbcharlen_utf8, check_mb_utf8_valid}, ++ { 303, UTF8_MB4, UTF8_MB4"_ja_0900_as_cs", 1, 4, "", mysqlnd_mbcharlen_utf8, check_mb_utf8_valid}, + { 0, NULL, NULL, 0, 0, NULL, NULL, NULL} + }; + /* }}} */ diff --git a/php-mysqlnd.patch b/php-mysqlnd.patch new file mode 100644 index 000000000000..88c4f76de662 --- /dev/null +++ b/php-mysqlnd.patch @@ -0,0 +1,22 @@ +--- a/ext/mysqlnd/mysqlnd_ps_codec.c ++++ b/ext/mysqlnd/mysqlnd_ps_codec.c +@@ -911,7 +911,7 @@ + zend_uchar *p = stmt->execute_cmd_buffer.buffer, + *cmd_buffer = stmt->execute_cmd_buffer.buffer; + size_t cmd_buffer_length = stmt->execute_cmd_buffer.length; +- enum_func_status ret; ++ enum_func_status ret = PASS; + + DBG_ENTER("mysqlnd_stmt_execute_generate_request"); + +@@ -928,7 +928,9 @@ + int1store(p, 1); /* and send 1 for iteration count */ + p+= 4; + +- ret = mysqlnd_stmt_execute_store_params(s, &cmd_buffer, &p, &cmd_buffer_length TSRMLS_CC); ++ if (stmt->param_count != 0) { ++ ret = mysqlnd_stmt_execute_store_params(s, &cmd_buffer, &p, &cmd_buffer_length TSRMLS_CC); ++ } + + *free_buffer = (cmd_buffer != stmt->execute_cmd_buffer.buffer); + *request_len = (p - cmd_buffer); diff --git a/php-opcache-lockfile-path.patch b/php-opcache-lockfile-path.patch new file mode 100644 index 000000000000..67239b3d81d1 --- /dev/null +++ b/php-opcache-lockfile-path.patch @@ -0,0 +1,94 @@ +diff --git a/ext/opcache/README b/ext/opcache/README +index d5513c5..78df179 100644 +--- a/ext/opcache/README ++++ b/ext/opcache/README +@@ -228,3 +228,6 @@ + processes have to map shared memory into the same address space. This + directive allows to manually fix the "Unable to reattach to base address" + errors. ++ ++opcache.lockfile_path (default "/tmp") ++ Absolute path used to store shared lockfiles. +diff --git a/ext/opcache/ZendAccelerator.h b/ext/opcache/ZendAccelerator.h +index a13c15c..2c659b1 100644 +--- a/ext/opcache/ZendAccelerator.h ++++ b/ext/opcache/ZendAccelerator.h +@@ -249,6 +249,7 @@ + long interned_strings_buffer; + #endif + char *restrict_api; ++ char *lockfile_path; + } zend_accel_directives; + + typedef struct _zend_accel_globals { +diff --git a/ext/opcache/zend_accelerator_module.c b/ext/opcache/zend_accelerator_module.c +index 5705ed7..430892c 100644 +--- a/ext/opcache/zend_accelerator_module.c ++++ b/ext/opcache/zend_accelerator_module.c +@@ -288,6 +288,7 @@ + STD_PHP_INI_BOOLEAN("opcache.enable_cli" , "0" , PHP_INI_SYSTEM, OnUpdateBool, accel_directives.enable_cli, zend_accel_globals, accel_globals) + STD_PHP_INI_ENTRY("opcache.error_log" , "" , PHP_INI_SYSTEM, OnUpdateString, accel_directives.error_log, zend_accel_globals, accel_globals) + STD_PHP_INI_ENTRY("opcache.restrict_api" , "" , PHP_INI_SYSTEM, OnUpdateString, accel_directives.restrict_api, zend_accel_globals, accel_globals) ++ STD_PHP_INI_ENTRY("opcache.lockfile_path" , "/tmp" , PHP_INI_SYSTEM, OnUpdateString, accel_directives.lockfile_path, zend_accel_globals, accel_globals) + + #ifdef ZEND_WIN32 + STD_PHP_INI_ENTRY("opcache.mmap_base", NULL, PHP_INI_SYSTEM, OnUpdateString, accel_directives.mmap_base, zend_accel_globals, accel_globals) +@@ -696,6 +697,7 @@ + add_assoc_bool(directives, "opcache.fast_shutdown", ZCG(accel_directives).fast_shutdown); + add_assoc_bool(directives, "opcache.enable_file_override", ZCG(accel_directives).file_override_enabled); + add_assoc_long(directives, "opcache.optimization_level", ZCG(accel_directives).optimization_level); ++ add_assoc_string(directives, "opcache.lockfile_path", STRING_NOT_NULL(ZCG(accel_directives).lockfile_path), 1); + + add_assoc_zval(return_value, "directives", directives); + +diff --git a/ext/opcache/zend_shared_alloc.c b/ext/opcache/zend_shared_alloc.c +index cde8114..66c901c 100644 +--- a/ext/opcache/zend_shared_alloc.c ++++ b/ext/opcache/zend_shared_alloc.c +@@ -38,7 +38,6 @@ + # include "sys/mman.h" + #endif + +-#define TMP_DIR "/tmp" + #define SEM_FILENAME_PREFIX ".ZendSem." + #define S_H(s) g_shared_alloc_handler->s + +@@ -56,7 +55,7 @@ + static MUTEX_T zts_lock; + #endif + int lock_file; +-static char lockfile_name[sizeof(TMP_DIR) + sizeof(SEM_FILENAME_PREFIX) + 8]; ++static char lockfile_name[MAXPATHLEN]; + #endif + + static const zend_shared_memory_handler_entry handler_table[] = { +@@ -76,7 +75,7 @@ + }; + + #ifndef ZEND_WIN32 +-void zend_shared_alloc_create_lock(void) ++void zend_shared_alloc_create_lock(char *lockfile_path) + { + int val; + +@@ -84,7 +83,7 @@ + zts_lock = tsrm_mutex_alloc(); + #endif + +- sprintf(lockfile_name, "%s/%sXXXXXX", TMP_DIR, SEM_FILENAME_PREFIX); ++ snprintf(lockfile_name, sizeof(lockfile_name), "%s/%sXXXXXX", lockfile_path, SEM_FILENAME_PREFIX); + lock_file = mkstemp(lockfile_name); + fchmod(lock_file, 0666); + +@@ -165,7 +164,11 @@ + smm_shared_globals = &tmp_shared_globals; + ZSMMG(shared_free) = requested_size; /* goes to tmp_shared_globals.shared_free */ + ++#ifndef ZEND_WIN32 ++ zend_shared_alloc_create_lock(ZCG(accel_directives).lockfile_path); ++#else + zend_shared_alloc_create_lock(); ++#endif + + if (ZCG(accel_directives).memory_model && ZCG(accel_directives).memory_model[0]) { + char *model = ZCG(accel_directives).memory_model; diff --git a/php-phpinfo.patch b/php-phpinfo.patch new file mode 100644 index 000000000000..72d0beaea4bd --- /dev/null +++ b/php-phpinfo.patch @@ -0,0 +1,22 @@ +--- a/ext/standard/info.c ++++ b/ext/standard/info.c +@@ -810,9 +810,6 @@ PHPAPI ZEND_COLD void php_print_info(int flag) + #ifdef ARCHITECTURE + php_info_print_table_row(2, "Architecture", ARCHITECTURE); + #endif +-#ifdef CONFIGURE_COMMAND +- php_info_print_table_row(2, "Configure Command", CONFIGURE_COMMAND ); +-#endif + + if (sapi_module.pretty_name) { + php_info_print_table_row(2, "Server API", sapi_module.pretty_name ); +--- a/ext/standard/tests/general_functions/phpinfo.phpt ++++ b/ext/standard/tests/general_functions/phpinfo.phpt +@@ -20,7 +20,6 @@ PHP Version => %s + + System => %s + Build Date => %s%a +-Configure Command => %s + Server API => Command Line Interface + Virtual Directory Support => %s + Configuration File (php.ini) Path => %s diff --git a/php.ini.patch b/php.ini.patch deleted file mode 100644 index 44006b8fd60f..000000000000 --- a/php.ini.patch +++ /dev/null @@ -1,120 +0,0 @@ ---- php.ini-production 2015-01-21 01:40:37.000000000 +0100 -+++ php.ini-production 2015-01-22 16:23:17.311890258 +0100 -@@ -295,7 +295,7 @@ - ; and below. This directive makes most sense if used in a per-directory - ; or per-virtualhost web server configuration file. - ; http://php.net/open-basedir --;open_basedir = -+open_basedir = /srv/http/:/home/:/tmp/:/usr/share/php56/pear/:/usr/share/webapps/ - - ; This directive allows you to disable certain functions for security reasons. - ; It receives a comma-delimited list of function names. -@@ -708,7 +708,7 @@ - ;;;;;;;;;;;;;;;;;;;;;;;;; - - ; UNIX: "/path1:/path2" --;include_path = ".:/php/includes" -+include_path = ".:/usr/share/php56/pear" - ; - ; Windows: "\path1;\path2" - ;include_path = ".;c:\php\includes" -@@ -731,7 +731,7 @@ - - ; Directory in which the loadable extensions (modules) reside. - ; http://php.net/extension-dir --; extension_dir = "./" -+extension_dir = "/usr/lib/php56/modules/" - ; On windows: - ; extension_dir = "ext" - -@@ -869,48 +869,48 @@ - ; If you only provide the name of the extension, PHP will look for it in its - ; default extension directory. - ; --; Windows Extensions --; Note that ODBC support is built in, so no dll is needed for it. --; Note that many DLL files are located in the extensions/ (PHP 4) ext/ (PHP 5) --; extension folders as well as the separate PECL DLL download (PHP 5). --; Be sure to appropriately set the extension_dir directive. --; --;extension=php_bz2.dll --;extension=php_curl.dll --;extension=php_fileinfo.dll --;extension=php_gd2.dll --;extension=php_gettext.dll --;extension=php_gmp.dll --;extension=php_intl.dll --;extension=php_imap.dll --;extension=php_interbase.dll --;extension=php_ldap.dll --;extension=php_mbstring.dll --;extension=php_exif.dll ; Must be after mbstring as it depends on it --;extension=php_mysql.dll --;extension=php_mysqli.dll --;extension=php_oci8_12c.dll ; Use with Oracle Database 12c Instant Client --;extension=php_openssl.dll --;extension=php_pdo_firebird.dll --;extension=php_pdo_mysql.dll --;extension=php_pdo_oci.dll --;extension=php_pdo_odbc.dll --;extension=php_pdo_pgsql.dll --;extension=php_pdo_sqlite.dll --;extension=php_pgsql.dll --;extension=php_shmop.dll -- --; The MIBS data available in the PHP distribution must be installed. --; See http://www.php.net/manual/en/snmp.installation.php --;extension=php_snmp.dll -- --;extension=php_soap.dll --;extension=php_sockets.dll --;extension=php_sqlite3.dll --;extension=php_sybase_ct.dll --;extension=php_tidy.dll --;extension=php_xmlrpc.dll --;extension=php_xsl.dll -+;extension=bcmath.so -+;extension=bz2.so -+;extension=calendar.so -+extension=curl.so -+;extension=dba.so -+;extension=enchant.so -+;extension=exif.so -+;extension=ftp.so -+;extension=gd.so -+extension=gettext.so -+;extension=gmp.so -+;extension=iconv.so -+;extension=imap.so -+;extension=intl.so -+;extension=ldap.so -+;extension=mcrypt.so -+;extension=mssql.so -+;extension=mysql.so -+;extension=mysqli.so -+;extension=odbc.so -+;zend_extension=opcache.so -+;extension=openssl.so -+;extension=pdo_mysql.so -+;extension=pdo_odbc.so -+;extension=pdo_pgsql.so -+;extension=pdo_sqlite.so -+;extension=pgsql.so -+;extension=phar.so -+;extension=posix.so -+;extension=pspell.so -+;extension=shmop.so -+;extension=snmp.so -+;extension=soap.so -+;extension=sockets.so -+;extension=sqlite3.so -+;extension=sysvmsg.so -+;extension=sysvsem.so -+;extension=sysvshm.so -+;extension=tidy.so -+;extension=xmlrpc.so -+;extension=xsl.so -+;extension=zip.so - - ;;;;;;;;;;;;;;;;;;; - ; Module Settings ; diff --git a/php55-phar-names.patch b/php55-phar-names.patch new file mode 100644 index 000000000000..eabb66065f71 --- /dev/null +++ b/php55-phar-names.patch @@ -0,0 +1,18 @@ +--- a/ext/phar/Makefile.frag ++++ b/ext/phar/Makefile.frag +@@ -37,10 +37,10 @@ + + install-pharcmd: pharcmd + -@$(mkinstalldirs) $(INSTALL_ROOT)$(bindir) +- $(INSTALL) $(builddir)/phar.phar $(INSTALL_ROOT)$(bindir) +- -@rm -f $(INSTALL_ROOT)$(bindir)/phar +- $(LN_S) -f phar.phar $(INSTALL_ROOT)$(bindir)/phar ++ $(INSTALL) $(builddir)/phar.phar $(INSTALL_ROOT)$(bindir)/$(program_prefix)phar$(program_suffix).phar ++ -@rm -f $(INSTALL_ROOT)$(bindir)/$(program_prefix)phar$(program_suffix) ++ $(LN_S) -f $(program_prefix)phar$(program_suffix).phar $(INSTALL_ROOT)$(bindir)/$(program_prefix)phar$(program_suffix) + @$(mkinstalldirs) $(INSTALL_ROOT)$(mandir)/man1 +- @$(INSTALL_DATA) $(builddir)/phar.1 $(INSTALL_ROOT)$(mandir)/man1/phar.1 +- @$(INSTALL_DATA) $(builddir)/phar.phar.1 $(INSTALL_ROOT)$(mandir)/man1/phar.phar.1 ++ @$(INSTALL_DATA) $(builddir)/phar.1 $(INSTALL_ROOT)$(mandir)/man1/$(program_prefix)phar$(program_suffix).1 ++ @$(INSTALL_DATA) $(builddir)/phar.phar.1 $(INSTALL_ROOT)$(mandir)/man1/$(program_prefix)phar$(program_suffix).phar.1 + diff --git a/recode-php5.3.patch b/recode-php5.3.patch new file mode 100644 index 000000000000..f7fa0105b78d --- /dev/null +++ b/recode-php5.3.patch @@ -0,0 +1,10 @@ +--- a/ext/recode/config9.m4 ++++ b/ext/recode/config9.m4 +@@ -13,6 +13,6 @@ + fi + + if test -n "$recode_conflict"; then +- AC_MSG_ERROR([recode extension can not be configured together with:$recode_conflict]) ++ AC_MSG_WARN([recode extension can not be configured together with:$recode_conflict]) + fi + fi diff --git a/timezonedb-guess.patch b/timezonedb-guess.patch new file mode 100644 index 000000000000..10c057e40799 --- /dev/null +++ b/timezonedb-guess.patch @@ -0,0 +1,27 @@ +index cf4a11b..f2ea919 100644 +--- a/ext/date/php_date.c ++++ b/ext/date/php_date.c +@@ -545,6 +545,23 @@ static char* guess_timezone(const timelib_tzdb *tzdb) + DATEG(timezone_valid) = 1; + return DATEG(default_timezone); + } ++ /* Try to guess timezone from system information */ ++ { ++ struct tm *ta, tmbuf; ++ time_t the_time; ++ char *tzid = NULL; ++ ++ the_time = time(NULL); ++ ta = php_localtime_r(&the_time, &tmbuf); ++ if (ta) { ++ tzid = timelib_timezone_id_from_abbr(ta->tm_zone, ta->tm_gmtoff, ta->tm_isdst); ++ } ++ if (! tzid) { ++ tzid = "UTC"; ++ } ++ ++ return tzid; ++ } + /* Fallback to UTC */ + return "UTC"; + } diff --git a/timezonedb-php5.6.patch b/timezonedb-php5.6.patch new file mode 100644 index 000000000000..eadb9515ddb8 --- /dev/null +++ b/timezonedb-php5.6.patch @@ -0,0 +1,623 @@ +--- a/ext/date/lib/parse_tz.c ++++ b/ext/date/lib/parse_tz.c +@@ -22,8 +22,22 @@ + * THE SOFTWARE. + */ + ++#ifndef PATH_MAX ++#define PATH_MAX 4096 ++#endif ++ + #include "timelib.h" + ++#ifdef HAVE_SYSTEM_TZDATA ++#include <sys/mman.h> ++#include <sys/stat.h> ++#include <limits.h> ++#include <fcntl.h> ++#include <unistd.h> ++ ++#include "php_scandir.h" ++#endif ++ + #include <stdio.h> + + #ifdef HAVE_LOCALE_H +@@ -37,7 +51,12 @@ + #endif + + #define TIMELIB_SUPPORTS_V2DATA ++ ++#ifndef HAVE_SYSTEM_TZDATA + #include "timezonedb.h" ++#endif ++ ++#include <ctype.h> + + #if (defined(__APPLE__) || defined(__APPLE_CC__)) && (defined(__BIG_ENDIAN__) || defined(__LITTLE_ENDIAN__)) + # if defined(__LITTLE_ENDIAN__) +@@ -59,6 +78,11 @@ static int read_preamble(const unsigned char **tzf, timelib_tzinfo *tz) + { + uint32_t version; + ++ if (memcmp(tzf, "TZif", 4) == 0) { ++ *tzf += 20; ++ return -1; ++ } ++ + /* read ID */ + version = (*tzf)[3] - '0'; + *tzf += 4; +@@ -302,7 +326,407 @@ void timelib_dump_tzinfo(timelib_tzinfo *tz) + } + } + +-static int seek_to_tz_position(const unsigned char **tzf, char *timezone, const timelib_tzdb *tzdb) ++#ifdef HAVE_SYSTEM_TZDATA ++ ++#ifdef HAVE_SYSTEM_TZDATA_PREFIX ++#define ZONEINFO_PREFIX HAVE_SYSTEM_TZDATA_PREFIX ++#else ++#define ZONEINFO_PREFIX "/usr/share/zoneinfo" ++#endif ++ ++/* System timezone database pointer. */ ++static const timelib_tzdb *timezonedb_system; ++ ++/* Hash table entry for the cache of the zone.tab mapping table. */ ++struct location_info { ++ char code[2]; ++ double latitude, longitude; ++ char name[64]; ++ char *comment; ++ struct location_info *next; ++}; ++ ++/* Cache of zone.tab. */ ++static struct location_info **system_location_table; ++ ++/* Size of the zone.tab hash table; a random-ish prime big enough to ++ * prevent too many collisions. */ ++#define LOCINFO_HASH_SIZE (1021) ++ ++/* Compute a case insensitive hash of str */ ++static uint32_t tz_hash(const char *str) ++{ ++ const unsigned char *p = (const unsigned char *)str; ++ uint32_t hash = 5381; ++ int c; ++ ++ while ((c = tolower(*p++)) != '\0') { ++ hash = (hash << 5) ^ hash ^ c; ++ } ++ ++ return hash % LOCINFO_HASH_SIZE; ++} ++ ++/* Parse an ISO-6709 date as used in zone.tab. Returns end of the ++ * parsed string on success, or NULL on parse error. On success, ++ * writes the parsed number to *result. */ ++static char *parse_iso6709(char *p, double *result) ++{ ++ double v, sign; ++ char *pend; ++ size_t len; ++ ++ if (*p == '+') ++ sign = 1.0; ++ else if (*p == '-') ++ sign = -1.0; ++ else ++ return NULL; ++ ++ p++; ++ for (pend = p; *pend >= '0' && *pend <= '9'; pend++) ++ ;; ++ ++ /* Annoying encoding used by zone.tab has no decimal point, so use ++ * the length to determine the format: ++ * ++ * 4 = DDMM ++ * 5 = DDDMM ++ * 6 = DDMMSS ++ * 7 = DDDMMSS ++ */ ++ len = pend - p; ++ if (len < 4 || len > 7) { ++ return NULL; ++ } ++ ++ /* p => [D]DD */ ++ v = (p[0] - '0') * 10.0 + (p[1] - '0'); ++ p += 2; ++ if (len == 5 || len == 7) ++ v = v * 10.0 + (*p++ - '0'); ++ /* p => MM[SS] */ ++ v += (10.0 * (p[0] - '0') ++ + p[1] - '0') / 60.0; ++ p += 2; ++ /* p => [SS] */ ++ if (len > 5) { ++ v += (10.0 * (p[0] - '0') ++ + p[1] - '0') / 3600.0; ++ p += 2; ++ } ++ ++ /* Round to five decimal place, not because it's a good idea, ++ * but, because the builtin data uses rounded data, so, match ++ * that. */ ++ *result = round(v * sign * 100000.0) / 100000.0; ++ ++ return p; ++} ++ ++/* This function parses the zone.tab file to build up the mapping of ++ * timezone to country code and geographic location, and returns a ++ * hash table. The hash table is indexed by the function: ++ * ++ * tz_hash(timezone-name) ++ */ ++static struct location_info **create_location_table(void) ++{ ++ struct location_info **li, *i; ++ char zone_tab[PATH_MAX]; ++ char line[512]; ++ FILE *fp; ++ ++ strncpy(zone_tab, ZONEINFO_PREFIX "/zone.tab", sizeof zone_tab); ++ ++ fp = fopen(zone_tab, "r"); ++ if (!fp) { ++ return NULL; ++ } ++ ++ li = calloc(LOCINFO_HASH_SIZE, sizeof *li); ++ ++ while (fgets(line, sizeof line, fp)) { ++ char *p = line, *code, *name, *comment; ++ uint32_t hash; ++ double latitude, longitude; ++ ++ while (isspace(*p)) ++ p++; ++ ++ if (*p == '#' || *p == '\0' || *p == '\n') ++ continue; ++ ++ if (!isalpha(p[0]) || !isalpha(p[1]) || p[2] != '\t') ++ continue; ++ ++ /* code => AA */ ++ code = p; ++ p[2] = 0; ++ p += 3; ++ ++ /* coords => [+-][D]DDMM[SS][+-][D]DDMM[SS] */ ++ p = parse_iso6709(p, &latitude); ++ if (!p) { ++ continue; ++ } ++ p = parse_iso6709(p, &longitude); ++ if (!p) { ++ continue; ++ } ++ ++ if (!p || *p != '\t') { ++ continue; ++ } ++ ++ /* name = string */ ++ name = ++p; ++ while (*p != '\t' && *p && *p != '\n') ++ p++; ++ ++ *p++ = '\0'; ++ ++ /* comment = string */ ++ comment = p; ++ while (*p != '\t' && *p && *p != '\n') ++ p++; ++ ++ if (*p == '\n' || *p == '\t') ++ *p = '\0'; ++ ++ hash = tz_hash(name); ++ i = malloc(sizeof *i); ++ memcpy(i->code, code, 2); ++ strncpy(i->name, name, sizeof i->name); ++ i->comment = strdup(comment); ++ i->longitude = longitude; ++ i->latitude = latitude; ++ i->next = li[hash]; ++ li[hash] = i; ++ /* printf("%s [%u, %f, %f]\n", name, hash, latitude, longitude); */ ++ } ++ ++ fclose(fp); ++ ++ return li; ++} ++ ++/* Return location info from hash table, using given timezone name. ++ * Returns NULL if the name could not be found. */ ++const struct location_info *find_zone_info(struct location_info **li, ++ const char *name) ++{ ++ uint32_t hash = tz_hash(name); ++ const struct location_info *l; ++ ++ if (!li) { ++ return NULL; ++ } ++ ++ for (l = li[hash]; l; l = l->next) { ++ if (strcasecmp(l->name, name) == 0) ++ return l; ++ } ++ ++ return NULL; ++} ++ ++/* Filter out some non-tzdata files and the posix/right databases, if ++ * present. */ ++static int index_filter(const struct dirent *ent) ++{ ++ return strcmp(ent->d_name, ".") != 0 ++ && strcmp(ent->d_name, "..") != 0 ++ && strcmp(ent->d_name, "posix") != 0 ++ && strcmp(ent->d_name, "posixrules") != 0 ++ && strcmp(ent->d_name, "right") != 0 ++ && strstr(ent->d_name, ".list") == NULL ++ && strstr(ent->d_name, ".tab") == NULL; ++} ++ ++static int sysdbcmp(const void *first, const void *second) ++{ ++ const timelib_tzdb_index_entry *alpha = first, *beta = second; ++ ++ return strcmp(alpha->id, beta->id); ++} ++ ++ ++/* Create the zone identifier index by trawling the filesystem. */ ++static void create_zone_index(timelib_tzdb *db) ++{ ++ size_t dirstack_size, dirstack_top; ++ size_t index_size, index_next; ++ timelib_tzdb_index_entry *db_index; ++ char **dirstack; ++ ++ /* LIFO stack to hold directory entries to scan; each slot is a ++ * directory name relative to the zoneinfo prefix. */ ++ dirstack_size = 32; ++ dirstack = malloc(dirstack_size * sizeof *dirstack); ++ dirstack_top = 1; ++ dirstack[0] = strdup(""); ++ ++ /* Index array. */ ++ index_size = 64; ++ db_index = malloc(index_size * sizeof *db_index); ++ index_next = 0; ++ ++ do { ++ struct dirent **ents; ++ char name[PATH_MAX], *top; ++ int count; ++ ++ /* Pop the top stack entry, and iterate through its contents. */ ++ top = dirstack[--dirstack_top]; ++ snprintf(name, sizeof name, ZONEINFO_PREFIX "/%s", top); ++ ++ count = php_scandir(name, &ents, index_filter, php_alphasort); ++ ++ while (count > 0) { ++ struct stat st; ++ const char *leaf = ents[count - 1]->d_name; ++ ++ snprintf(name, sizeof name, ZONEINFO_PREFIX "/%s/%s", ++ top, leaf); ++ ++ if (strlen(name) && stat(name, &st) == 0) { ++ /* Name, relative to the zoneinfo prefix. */ ++ const char *root = top; ++ ++ if (root[0] == '/') root++; ++ ++ snprintf(name, sizeof name, "%s%s%s", root, ++ *root ? "/": "", leaf); ++ ++ if (S_ISDIR(st.st_mode)) { ++ if (dirstack_top == dirstack_size) { ++ dirstack_size *= 2; ++ dirstack = realloc(dirstack, ++ dirstack_size * sizeof *dirstack); ++ } ++ dirstack[dirstack_top++] = strdup(name); ++ } ++ else { ++ if (index_next == index_size) { ++ index_size *= 2; ++ db_index = realloc(db_index, ++ index_size * sizeof *db_index); ++ } ++ ++ db_index[index_next++].id = strdup(name); ++ } ++ } ++ ++ free(ents[--count]); ++ } ++ ++ if (count != -1) free(ents); ++ free(top); ++ } while (dirstack_top); ++ ++ qsort(db_index, index_next, sizeof *db_index, sysdbcmp); ++ ++ db->index = db_index; ++ db->index_size = index_next; ++ ++ free(dirstack); ++} ++ ++#define FAKE_HEADER "1234\0??\1??" ++#define FAKE_UTC_POS (7 - 4) ++ ++/* Create a fake data segment for database 'sysdb'. */ ++static void fake_data_segment(timelib_tzdb *sysdb, ++ struct location_info **info) ++{ ++ size_t n; ++ char *data, *p; ++ ++ data = malloc(3 * sysdb->index_size + 7); ++ ++ p = mempcpy(data, FAKE_HEADER, sizeof(FAKE_HEADER) - 1); ++ ++ for (n = 0; n < sysdb->index_size; n++) { ++ const struct location_info *li; ++ timelib_tzdb_index_entry *ent; ++ ++ ent = (timelib_tzdb_index_entry *)&sysdb->index[n]; ++ ++ /* Lookup the timezone name in the hash table. */ ++ if (strcmp(ent->id, "UTC") == 0) { ++ ent->pos = FAKE_UTC_POS; ++ continue; ++ } ++ ++ li = find_zone_info(info, ent->id); ++ if (li) { ++ /* If found, append the BC byte and the ++ * country code; set the position for this ++ * section of timezone data. */ ++ ent->pos = (p - data) - 4; ++ *p++ = '\1'; ++ *p++ = li->code[0]; ++ *p++ = li->code[1]; ++ } ++ else { ++ /* If not found, the timezone data can ++ * point at the header. */ ++ ent->pos = 0; ++ } ++ } ++ ++ sysdb->data = (unsigned char *)data; ++} ++ ++/* Returns true if the passed-in stat structure describes a ++ * probably-valid timezone file. */ ++static int is_valid_tzfile(const struct stat *st) ++{ ++ return S_ISREG(st->st_mode) && st->st_size > 20; ++} ++ ++/* Return the mmap()ed tzfile if found, else NULL. On success, the ++ * length of the mapped data is placed in *length. */ ++static char *map_tzfile(const char *timezone, size_t *length) ++{ ++ char fname[PATH_MAX]; ++ struct stat st; ++ char *p; ++ int fd; ++ ++ if (timezone[0] == '\0' || strstr(timezone, "..") != NULL) { ++ return NULL; ++ } ++ ++ if (system_location_table) { ++ const struct location_info *li; ++ if ((li = find_zone_info(system_location_table, timezone)) != NULL) { ++ /* Use the stored name to avoid case issue */ ++ timezone = li->name; ++ } ++ } ++ ++ snprintf(fname, sizeof fname, ZONEINFO_PREFIX "/%s", timezone); ++ ++ fd = open(fname, O_RDONLY); ++ if (fd == -1) { ++ return NULL; ++ } else if (fstat(fd, &st) != 0 || !is_valid_tzfile(&st)) { ++ close(fd); ++ return NULL; ++ } ++ ++ *length = st.st_size; ++ p = mmap(NULL, st.st_size, PROT_READ, MAP_SHARED, fd, 0); ++ close(fd); ++ ++ return p != MAP_FAILED ? p : NULL; ++} ++ ++#endif ++ ++static int inmem_seek_to_tz_position(const unsigned char **tzf, char *timezone, const timelib_tzdb *tzdb) + { + int left = 0, right = tzdb->index_size - 1; + #ifdef HAVE_SETLOCALE +@@ -341,21 +765,90 @@ static int seek_to_tz_position(const unsigned char **tzf, char *timezone, const + return 0; + } + ++static int seek_to_tz_position(const unsigned char **tzf, char *timezone, ++ char **map, size_t *maplen, ++ const timelib_tzdb *tzdb) ++{ ++#ifdef HAVE_SYSTEM_TZDATA ++ if (tzdb == timezonedb_system) { ++ char *orig; ++ ++ orig = map_tzfile(timezone, maplen); ++ if (orig == NULL) { ++ return 0; ++ } ++ ++ (*tzf) = (unsigned char *)orig; ++ *map = orig; ++ ++ return 1; ++ } ++ else ++#endif ++ { ++ return inmem_seek_to_tz_position(tzf, timezone, tzdb); ++ } ++} ++ + const timelib_tzdb *timelib_builtin_db(void) + { ++#ifdef HAVE_SYSTEM_TZDATA ++ if (timezonedb_system == NULL) { ++ timelib_tzdb *tmp = malloc(sizeof *tmp); ++ ++ tmp->version = "0.system"; ++ tmp->data = NULL; ++ create_zone_index(tmp); ++ system_location_table = create_location_table(); ++ fake_data_segment(tmp, system_location_table); ++ timezonedb_system = tmp; ++ } ++ ++ ++ return timezonedb_system; ++#else + return &timezonedb_builtin; ++#endif + } + + const timelib_tzdb_index_entry *timelib_timezone_builtin_identifiers_list(int *count) + { ++#ifdef HAVE_SYSTEM_TZDATA ++ *count = timezonedb_system->index_size; ++ return timezonedb_system->index; ++#else + *count = sizeof(timezonedb_idx_builtin) / sizeof(*timezonedb_idx_builtin); + return timezonedb_idx_builtin; ++#endif + } + + int timelib_timezone_id_is_valid(char *timezone, const timelib_tzdb *tzdb) + { + const unsigned char *tzf; +- return (seek_to_tz_position(&tzf, timezone, tzdb)); ++ ++#ifdef HAVE_SYSTEM_TZDATA ++ if (tzdb == timezonedb_system) { ++ char fname[PATH_MAX]; ++ struct stat st; ++ ++ if (timezone[0] == '\0' || strstr(timezone, "..") != NULL) { ++ return 0; ++ } ++ ++ if (system_location_table) { ++ if (find_zone_info(system_location_table, timezone) != NULL) { ++ /* found in cache */ ++ return 1; ++ } ++ } ++ ++ snprintf(fname, sizeof fname, ZONEINFO_PREFIX "/%s", timezone); ++ ++ return stat(fname, &st) == 0 && is_valid_tzfile(&st); ++ } ++#endif ++ ++ return (inmem_seek_to_tz_position(&tzf, timezone, tzdb)); + } + + static void skip_64bit_preamble(const unsigned char **tzf, timelib_tzinfo *tz) +@@ -380,10 +873,12 @@ static void read_64bit_header(const unsigned char **tzf, timelib_tzinfo *tz) + timelib_tzinfo *timelib_parse_tzfile(char *timezone, const timelib_tzdb *tzdb) + { + const unsigned char *tzf; ++ char *memmap = NULL; ++ size_t maplen; + timelib_tzinfo *tmp; + int version; + +- if (seek_to_tz_position(&tzf, timezone, tzdb)) { ++ if (seek_to_tz_position(&tzf, timezone, &memmap, &maplen, tzdb)) { + tmp = timelib_tzinfo_ctor(timezone); + + version = read_preamble(&tzf, tmp); +@@ -397,7 +892,34 @@ timelib_tzinfo *timelib_parse_tzfile(char *timezone, const timelib_tzdb *tzdb) + skip_64bit_types(&tzf, tmp); + skip_posix_string(&tzf, tmp); + } +- read_location(&tzf, tmp); ++ ++#ifdef HAVE_SYSTEM_TZDATA ++ if (memmap) { ++ const struct location_info *li; ++ ++ /* TZif-style - grok the location info from the system database, ++ * if possible. */ ++ ++ if ((li = find_zone_info(system_location_table, timezone)) != NULL) { ++ tmp->location.comments = strdup(li->comment); ++ strncpy(tmp->location.country_code, li->code, 2); ++ tmp->location.longitude = li->longitude; ++ tmp->location.latitude = li->latitude; ++ tmp->bc = 1; ++ } else { ++ strcpy(tmp->location.country_code, "??"); ++ tmp->bc = 0; ++ tmp->location.comments = strdup(""); ++ } ++ ++ /* Now done with the mmap segment - discard it. */ ++ munmap(memmap, maplen); ++ } else ++#endif ++ { ++ /* PHP-style - use the embedded info. */ ++ read_location(&tzf, tmp); ++ } + } else { + tmp = NULL; + } +diff --git a/ext/date/lib/timelib.m4 b/ext/date/lib/timelib.m4 +index c725572..4c837c7 100644 +--- a/ext/date/lib/timelib.m4 ++++ b/ext/date/lib/timelib.m4 +@@ -78,3 +78,17 @@ stdlib.h + + dnl Check for strtoll, atoll + AC_CHECK_FUNCS(strtoll atoll strftime) ++ ++PHP_ARG_WITH(system-tzdata, for use of system timezone data, ++[ --with-system-tzdata[=DIR] to specify use of system timezone data], ++no, no) ++ ++if test "$PHP_SYSTEM_TZDATA" != "no"; then ++ AC_DEFINE(HAVE_SYSTEM_TZDATA, 1, [Define if system timezone data is used]) ++ ++ if test "$PHP_SYSTEM_TZDATA" != "yes"; then ++ AC_DEFINE_UNQUOTED(HAVE_SYSTEM_TZDATA_PREFIX, "$PHP_SYSTEM_TZDATA", ++ [Define for location of system timezone data]) ++ fi ++fi ++ diff --git a/use-enchant2.patch b/use-enchant2.patch deleted file mode 100644 index d505a7cc48c8..000000000000 --- a/use-enchant2.patch +++ /dev/null @@ -1,87 +0,0 @@ ---- configure 2018-01-03 01:28:11.000000000 +0100 -+++ configure 2018-02-26 11:20:37.169756435 +0100 -@@ -35874,9 +35874,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 -@@ -35898,7 +35898,7 @@ - - - if test "$ext_shared" = "yes"; then -- ENCHANT_SHARED_LIBADD="-lenchant $ENCHANT_SHARED_LIBADD" -+ ENCHANT_SHARED_LIBADD="-lenchant-2 $ENCHANT_SHARED_LIBADD" - if test -n "$ENCHANT_LIBDIR"; then - - if test "$ENCHANT_LIBDIR" != "/usr/$PHP_LIBDIR" && test "$ENCHANT_LIBDIR" != "/usr/lib"; then -@@ -35982,7 +35982,7 @@ - case enchant in - c|c_r|pthread*) ;; - *) -- LIBS="-lenchant $LIBS" -+ LIBS="-lenchant-2 $LIBS" - ;; - esac - -@@ -36118,13 +36118,13 @@ - esac - done - -- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for enchant_broker_set_param in -lenchant" >&5 --$as_echo_n "checking for enchant_broker_set_param in -lenchant... " >&6; } -+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for enchant_broker_set_param in -lenchant-2" >&5 -+$as_echo_n "checking for enchant_broker_set_param in -lenchant-2... " >&6; } - if test "${ac_cv_lib_enchant_enchant_broker_set_param+set}" = set; then : - $as_echo_n "(cached) " >&6 - else - ac_check_lib_save_LIBS=$LIBS --LIBS="-lenchant $LIBS" -+LIBS="-lenchant-2 $LIBS" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext - /* end confdefs.h. */ - ---- ext/enchant/enchant.c 2018-01-02 22:36:05.000000000 +0000 -+++ ext/enchant/enchant.c 2018-01-21 22:34:50.205791491 +0000 -@@ -750,7 +750,7 @@ - for (i = 0; i < n_sugg; i++) { - add_next_index_string(sugg, suggs[i]); - } -- enchant_dict_free_suggestions(pdict->pdict, suggs); -+ enchant_dict_free_string_list(pdict->pdict, suggs); - } - - -@@ -807,7 +807,7 @@ - add_next_index_string(return_value, suggs[i]); - } - -- enchant_dict_free_suggestions(pdict->pdict, suggs); -+ enchant_dict_free_string_list(pdict->pdict, suggs); - } - } - /* }}} */ -@@ -827,7 +827,7 @@ - - PHP_ENCHANT_GET_DICT; - -- enchant_dict_add_to_personal(pdict->pdict, word, wordlen); -+ enchant_dict_add(pdict->pdict, word, wordlen); - } - /* }}} */ - -@@ -865,7 +865,7 @@ - - PHP_ENCHANT_GET_DICT; - -- RETURN_BOOL(enchant_dict_is_in_session(pdict->pdict, word, wordlen)); -+ RETURN_BOOL(enchant_dict_is_added(pdict->pdict, word, wordlen)); - } - /* }}} */ - |