summary refs log tree commit diff
diff options
context:
space:
mode:
authorPol Dellaiera <pol.dellaiera@protonmail.com>2023-06-26 20:51:23 +0200
committerGitHub <noreply@github.com>2023-06-26 20:51:23 +0200
commit5f85fe1e8ae2a00004e854c7585bc0f8840c0009 (patch)
tree18d15c5620f153a073b662c3627c4a3923ed15dd
parent7f8a16b9f54c272bea8af6ba66b4c80e8a6e4afe (diff)
downloadnixpkgs-5f85fe1e8ae2a00004e854c7585bc0f8840c0009.tar
nixpkgs-5f85fe1e8ae2a00004e854c7585bc0f8840c0009.tar.gz
nixpkgs-5f85fe1e8ae2a00004e854c7585bc0f8840c0009.tar.bz2
nixpkgs-5f85fe1e8ae2a00004e854c7585bc0f8840c0009.tar.lz
nixpkgs-5f85fe1e8ae2a00004e854c7585bc0f8840c0009.tar.xz
nixpkgs-5f85fe1e8ae2a00004e854c7585bc0f8840c0009.tar.zst
nixpkgs-5f85fe1e8ae2a00004e854c7585bc0f8840c0009.zip
php83: init at 8.3.0alpha2 (#239151)
* php83: init at 8.3.0alpha2

* phpExtensions.blackfire: disable for php 8.3

* phpExtensions.apcu: patch for 8.3 only
-rw-r--r--nixos/tests/all-tests.nix1
-rw-r--r--pkgs/development/interpreters/php/8.3.nix57
-rw-r--r--pkgs/development/interpreters/php/fix-fileinfo-ext-php83.patch14
-rw-r--r--pkgs/development/php-packages/apcu/default.nix9
-rw-r--r--pkgs/top-level/all-packages.nix10
-rw-r--r--pkgs/top-level/php-packages.nix58
6 files changed, 126 insertions, 23 deletions
diff --git a/nixos/tests/all-tests.nix b/nixos/tests/all-tests.nix
index a7179a028e9..6e9c893c809 100644
--- a/nixos/tests/all-tests.nix
+++ b/nixos/tests/all-tests.nix
@@ -597,6 +597,7 @@ in {
   php = handleTest ./php {};
   php81 = handleTest ./php { php = pkgs.php81; };
   php82 = handleTest ./php { php = pkgs.php82; };
+  php83 = handleTest ./php { php = pkgs.php83; };
   phylactery = handleTest ./web-apps/phylactery.nix {};
   pict-rs = handleTest ./pict-rs.nix {};
   pinnwand = handleTest ./pinnwand.nix {};
diff --git a/pkgs/development/interpreters/php/8.3.nix b/pkgs/development/interpreters/php/8.3.nix
new file mode 100644
index 00000000000..b49c89050f8
--- /dev/null
+++ b/pkgs/development/interpreters/php/8.3.nix
@@ -0,0 +1,57 @@
+{ callPackage, fetchurl, ... }@_args:
+
+let
+  base = (callPackage ./generic.nix (_args // {
+    version = "8.3.0alpha2";
+    hash = null;
+  })).overrideAttrs (oldAttrs: {
+    src = fetchurl {
+      url = "https://downloads.php.net/~eric/php-8.3.0alpha2.tar.xz";
+      hash = "sha256-YLCxgiDcsBisOmAodf0h8HyaCIh+4i1Q7QZw/h4KR5I=";
+    };
+  });
+in
+base.withExtensions ({ all, ... }: with all; ([
+  bcmath
+  calendar
+  curl
+  ctype
+  dom
+  exif
+  fileinfo
+  filter
+  ftp
+  gd
+  gettext
+  gmp
+  iconv
+  imap
+  intl
+  ldap
+  mbstring
+  mysqli
+  mysqlnd
+  opcache
+  openssl
+  pcntl
+  pdo
+  pdo_mysql
+  pdo_odbc
+  pdo_pgsql
+  pdo_sqlite
+  pgsql
+  posix
+  readline
+  session
+  simplexml
+  sockets
+  soap
+  sodium
+  sysvsem
+  sqlite3
+  tokenizer
+  xmlreader
+  xmlwriter
+  zip
+  zlib
+]))
diff --git a/pkgs/development/interpreters/php/fix-fileinfo-ext-php83.patch b/pkgs/development/interpreters/php/fix-fileinfo-ext-php83.patch
new file mode 100644
index 00000000000..fbd6a66dbd1
--- /dev/null
+++ b/pkgs/development/interpreters/php/fix-fileinfo-ext-php83.patch
@@ -0,0 +1,14 @@
+diff --git a/ext/fileinfo/fileinfo.c b/ext/fileinfo/fileinfo.c
+index a6f3e64db6..c3047233db 100644
+--- a/ext/fileinfo/fileinfo.c
++++ b/ext/fileinfo/fileinfo.c
+@@ -14,6 +14,9 @@
+   +----------------------------------------------------------------------+
+ */
+
++#ifdef HAVE_CONFIG_H
++#include "config.h"
++#endif
+ #include "php.h"
+
+ #include "libmagic/magic.h"
diff --git a/pkgs/development/php-packages/apcu/default.nix b/pkgs/development/php-packages/apcu/default.nix
index 556d28ba013..ffb3ef3771b 100644
--- a/pkgs/development/php-packages/apcu/default.nix
+++ b/pkgs/development/php-packages/apcu/default.nix
@@ -1,4 +1,4 @@
-{ buildPecl, lib, pcre2, fetchFromGitHub }:
+{ buildPecl, lib, pcre2, fetchFromGitHub, php, fetchpatch }:
 
 let
   version = "5.1.22";
@@ -13,6 +13,13 @@ in buildPecl {
     sha256 = "sha256-L4a+/kWT95a1Km+FzFNiAaBw8enU6k4ZiCFRErjj9o8=";
   };
 
+  patches = lib.optionals (lib.versionAtLeast php.version "8.3") [
+    (fetchpatch {
+      url = "https://github.com/krakjoe/apcu/commit/c9a29161c68c0faf71046e8f03f6a90900023ded.patch";
+      hash = "sha256-B0ZKk9TJy2+sYGs7TEX2KxUiOVawIb+RXNgToU1Fz5I=";
+    })
+  ];
+
   buildInputs = [ pcre2 ];
   doCheck = true;
   checkTarget = "test";
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index 175f022efc3..69aa034d24d 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -17338,6 +17338,16 @@ with pkgs;
   phpExtensions = php.extensions;
   phpPackages = php.packages;
 
+  # Import PHP83 interpreter, extensions and packages
+  php83 = callPackage ../development/interpreters/php/8.3.nix {
+    stdenv = if stdenv.cc.isClang then llvmPackages.stdenv else stdenv;
+    pcre2 = pcre2.override {
+      withJitSealloc = false; # See https://bugs.php.net/bug.php?id=78927 and https://bugs.php.net/bug.php?id=78630
+    };
+  };
+  php83Extensions = recurseIntoAttrs php83.extensions;
+  php83Packages = recurseIntoAttrs php83.packages;
+
   # Import PHP82 interpreter, extensions and packages
   php82 = callPackage ../development/interpreters/php/8.2.nix {
     stdenv = if stdenv.cc.isClang then llvmPackages.stdenv else stdenv;
diff --git a/pkgs/top-level/php-packages.nix b/pkgs/top-level/php-packages.nix
index 6d03fddc015..2be6447f83b 100644
--- a/pkgs/top-level/php-packages.nix
+++ b/pkgs/top-level/php-packages.nix
@@ -1,7 +1,6 @@
 { stdenv
 , lib
 , pkgs
-, fetchgit
 , phpPackage
 , autoconf
 , pkg-config
@@ -10,22 +9,16 @@
 , curl
 , cyrus_sasl
 , enchant2
-, fetchpatch
 , freetds
-, freetype
 , gd
 , gettext
 , gmp
 , html-tidy
 , icu64
-, libXpm
 , libffi
 , libiconv
-, libjpeg
 , libkrb5
-, libpng
 , libsodium
-, libwebp
 , libxml2
 , libxslt
 , libzip
@@ -46,6 +39,7 @@
 , uwimap
 , valgrind
 , zlib
+, fetchpatch
 }:
 
 lib.makeScope pkgs.newScope (self: with self; {
@@ -84,15 +78,15 @@ lib.makeScope pkgs.newScope (self: with self; {
   # will mark the extension as a zend extension or not.
   mkExtension = lib.makeOverridable
     ({ name
-    , configureFlags ? [ "--enable-${extName}" ]
-    , internalDeps ? [ ]
-    , postPhpize ? ""
-    , buildInputs ? [ ]
-    , zendExtension ? false
-    , doCheck ? true
-    , extName ? name
-    , ...
-    }@args: stdenv.mkDerivation ((builtins.removeAttrs args [ "name" ]) // {
+     , configureFlags ? [ "--enable-${extName}" ]
+     , internalDeps ? [ ]
+     , postPhpize ? ""
+     , buildInputs ? [ ]
+     , zendExtension ? false
+     , doCheck ? true
+     , extName ? name
+     , ...
+     }@args: stdenv.mkDerivation ((builtins.removeAttrs args [ "name" ]) // {
       pname = "php-${name}";
       extensionName = extName;
 
@@ -216,8 +210,6 @@ lib.makeScope pkgs.newScope (self: with self; {
 
     ast = callPackage ../development/php-packages/ast { };
 
-    blackfire = pkgs.callPackage ../development/tools/misc/blackfire/php-probe.nix { inherit php; };
-
     couchbase = callPackage ../development/php-packages/couchbase { };
 
     datadog_trace = callPackage ../development/php-packages/datadog_trace { };
@@ -282,7 +274,7 @@ lib.makeScope pkgs.newScope (self: with self; {
 
     redis = callPackage ../development/php-packages/redis { };
 
-    relay = callPackage ../development/php-packages/relay  { inherit php; };
+    relay = callPackage ../development/php-packages/relay { inherit php; };
 
     smbclient = callPackage ../development/php-packages/smbclient { };
 
@@ -332,7 +324,16 @@ lib.makeScope pkgs.newScope (self: with self; {
         }
         { name = "exif"; doCheck = false; }
         { name = "ffi"; buildInputs = [ libffi ]; }
-        { name = "fileinfo"; buildInputs = [ pcre2 ]; }
+        {
+          name = "fileinfo";
+          buildInputs = [ pcre2 ];
+          patches = lib.optionals (lib.versionAtLeast php.version "8.3") [
+            # Fix the extension unable to be loaded due to missing `get_module` function.
+            # `ZEND_GET_MODULE` macro that creates it is conditional on `COMPILE_DL_FILEINFO` being defined.
+            # https://github.com/php/php-src/issues/11408#issuecomment-1602106200
+            ../development/interpreters/php/fix-fileinfo-ext-php83.patch
+          ];
+        }
         { name = "filter"; buildInputs = [ pcre2 ]; }
         { name = "ftp"; buildInputs = [ openssl ]; }
         {
@@ -519,7 +520,18 @@ lib.makeScope pkgs.newScope (self: with self; {
           '';
           doCheck = false;
         }
-        { name = "session"; doCheck = false; }
+        { name = "session";
+          doCheck = false;
+          patches = lib.optionals (lib.versionAtLeast php.version "8.3") [
+            # Fix GH-11529: Crash after dealing with an Apache request
+            # To be removed in next alpha
+            # See https://github.com/php/php-src/issues/11529
+            (fetchpatch {
+              url = "https://github.com/php/php-src/commit/8d4370954ec610164a4503431bb0c52da6954aa7.patch";
+              hash = "sha256-w1uF9lRdfhz9I0gux0J4cvMzNS93uSHL1fYG23VLDPc=";
+            })
+          ];
+        }
         { name = "shmop"; }
         {
           name = "simplexml";
@@ -625,5 +637,7 @@ lib.makeScope pkgs.newScope (self: with self; {
       # Produce the final attribute set of all extensions defined.
     in
     builtins.listToAttrs namedExtensions
-  );
+  ) // lib.optionalAttrs (!(lib.versionAtLeast php.version "8.3")) {
+    blackfire = callPackage ../development/tools/misc/blackfire/php-probe.nix { inherit php; };
+  };
 })