Skip to content

Commit ac68d32

Browse files
committed
Update with main (only PHP 8.3)
1 parent cd90255 commit ac68d32

File tree

5 files changed

+29
-6
lines changed

5 files changed

+29
-6
lines changed

layers/bootstrap.php

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,15 @@
22

33
$appRoot = getenv('LAMBDA_TASK_ROOT');
44

5-
if (getenv('BREF_AUTOLOAD_PATH')) {
6-
require getenv('BREF_AUTOLOAD_PATH');
7-
} elseif (file_exists($appRoot . '/vendor/autoload.php')) {
8-
require $appRoot . '/vendor/autoload.php';
5+
$autoloadPath = $_SERVER['BREF_AUTOLOAD_PATH'] ?? null;
6+
if (! $autoloadPath) {
7+
$autoloadPath = $appRoot . '/vendor/autoload.php';
98
}
9+
if (! file_exists($autoloadPath)) {
10+
throw new RuntimeException('Could not find the Composer vendor directory. Did you run "composer require bref/bref"? Read https://bref.sh/docs/environment/php#custom-vendor-path if your Composer vendor directory is in a custom path.');
11+
}
12+
13+
require $autoloadPath;
1014

1115
$runtimeClass = getenv('RUNTIME_CLASS');
1216

layers/fpm-dev/Dockerfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@ EXPOSE 8000
3636
# Add `php/conf.dev.d` to the path where PHP looks for configuration files
3737
ENV PHP_INI_SCAN_DIR="/opt/bref/etc/php/conf.d:/var/task/php/conf.d:/var/task/php/conf.dev.d"
3838

39+
# Add composer
40+
COPY --link --from=composer/composer:2-bin /composer /usr/bin/composer
41+
3942
# Originally the entrypoint is `/lambda-entrypoint.sh` and CMD contains the handler name
4043
# We override the entrypoint to run our own logic
4144
ENTRYPOINT [ "/bref-entrypoint.sh" ]

php-83/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
ARG IMAGE_VERSION_SUFFIX
55

66
# https://www.php.net/downloads
7-
ARG VERSION_PHP=8.3.6
7+
ARG VERSION_PHP=8.3.12
88

99

1010
# Lambda uses a custom AMI named Amazon Linux 2

tests/test_2_extensions.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,16 @@
9191
'curl-openssl-certificates-backwards-compatibility' => file_exists('/opt/bref/ssl/cert.pem'),
9292
// Make sure we are using curl with our compiled libssh
9393
'curl-libssh' => version_compare(str_replace('libssh2/', '', curl_version()['libssh_version']), '1.10.0', '>='),
94+
'openssl' => (function() {
95+
$private_key = openssl_pkey_new(['private_key_bits' => 2048]);
96+
if ($private_key === false) {
97+
return false;
98+
}
99+
100+
$public_key_pem = openssl_pkey_get_details($private_key)['key'];
101+
$details = openssl_pkey_get_details(openssl_pkey_get_public($public_key_pem));
102+
return $details['bits'] === 2048;
103+
})(),
94104
'json' => function_exists('json_encode'),
95105
'bcmath' => function_exists('bcadd'),
96106
'ctype' => function_exists('ctype_digit'),

utils/lib-copy/copy-dependencies.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,13 @@
3636
$librariesThatExistOnLambda = array_map('trim', $librariesThatExistOnLambda);
3737
// For some reason some libraries are actually not in Lambda, despite being in the docker image 🤷
3838
$librariesThatExistOnLambda = array_filter($librariesThatExistOnLambda, function ($library) {
39-
return ! str_contains($library, 'libgcrypt.so') && ! str_contains($library, 'libgpg-error.so');
39+
return ! str_contains($library, 'libgcrypt.so')
40+
&& ! str_contains($library, 'libassuan.so')
41+
&& ! str_contains($library, 'libgobject-2.0.so')
42+
&& ! str_contains($library, 'libgpg-error.so')
43+
&& ! str_contains($library, 'libgpgme-pthread.so')
44+
&& ! str_contains($library, 'libgpgme.so')
45+
;
4046
});
4147

4248
$requiredLibraries = listDependencies($pathToCheck);

0 commit comments

Comments
 (0)