Skip to content

php-apache-dev:8.1-alpine ReflectionAttribute::newInstance segmentation fault; non-dev images work fine #538

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
jurchiks opened this issue Feb 14, 2025 · 0 comments

Comments

@jurchiks
Copy link

jurchiks commented Feb 14, 2025

docker-compose.yml:

services:
    app:
        image: webdevops/php-apache-dev:8.1-alpine
        working_dir: /app
        volumes:
            - ./:/app:rw,cached

test.php:

<?php
#[Attribute(Attribute::TARGET_CLASS)]
final class Table {
    public function __construct(public readonly string $name) {}
}

#[Table('users')]
class TestClass {}

$testClass = new TestClass();
$attributes = (new ReflectionClass($testClass))->getAttributes();
var_dump($attributes);
foreach ($attributes as $attribute) {
    var_dump($attribute->newInstance());
}

The problem:

3948cef7d689:/app# php test.php
array(1) {
  [0]=>
  object(ReflectionAttribute)#3 (0) {
  }
}
Segmentation fault
3948cef7d689:/app#

I tested webdevops/php:8.1-alpine, and this same code worked there as expected.
I tested webdevops/php-apache:8.1-alpine, and this also worked as expected.
I tested webdevops/php-dev:8.1-alpine, and this failed.
I tested webdevops/php-dev:8.2-alpine, and this worked.
I tested webdevops/php-dev:8.3-alpine, and this worked.
I tested php:8.1-fpm-alpine, and this worked!
Clearly, something about the -dev version of specifically your flavor of PHP 8.1 fails.
Maybe also 8.0, but I have no need to test it as it's in the past.

For the record, I was upgrading from webdevops/php-apache-dev:7.3-alpine, which was also working fine, so the window of error is very narrow.

@jurchiks jurchiks changed the title php-apache-dev:8.1-alpine ReflectionAttribute::newInstance segmentation fault; non-dev image works fine php-apache-dev:8.1-alpine ReflectionAttribute::newInstance segmentation fault; non-dev images work fine Feb 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant