codeigniter4 / CodeIgniter4

Open Source PHP Framework (originally from EllisLab)
https://codeigniter.com/
MIT License
5.3k stars 1.89k forks source link

Bug: Ubuntu 22.04 Segmentation fault with "composer create-project codeigniter4/appstarter project-root" #7393

Closed joho1968 closed 1 year ago

joho1968 commented 1 year ago

PHP Version

8.1

CodeIgniter4 Version

I would assume this pulls the latest version

CodeIgniter4 Installation Method

Composer (using codeigniter4/appstarter)

Which operating systems have you tested for this bug?

Linux

Which server did you use?

fpm-fcgi

Database

n/a

What happened?

Doing this composer create-project codeigniter4/appstarter my_test_app ends with this:

[304] https://repo.packagist.org/p2/phpdocumentor/type-resolver.json
[304] https://repo.packagist.org/p2/webmozart/assert.json
[304] https://repo.packagist.org/p2/phpdocumentor/reflection-common.json
[304] https://repo.packagist.org/p2/dflydev/markdown.json
Reading /var/www/ltest2/.cache/composer/repo/https---repo.packagist.org/provider-phpstan~phpdoc-parser.json from cache
Downloading https://repo.packagist.org/p2/phpstan/phpdoc-parser.json if modified
Reading /var/www/ltest2/.cache/composer/repo/https---repo.packagist.org/provider-doctrine~deprecations.json from cache
Downloading https://repo.packagist.org/p2/doctrine/deprecations.json if modified
Reading /var/www/ltest2/.cache/composer/repo/https---repo.packagist.org/provider-symfony~polyfill-ctype.json from cache
Downloading https://repo.packagist.org/p2/symfony/polyfill-ctype.json if modified
[304] https://repo.packagist.org/p2/phpstan/phpdoc-parser.json
[304] https://repo.packagist.org/p2/doctrine/deprecations.json
[304] https://repo.packagist.org/p2/symfony/polyfill-ctype.json
Built pool.
Running pool optimizer.
Segmentation fault (core dumped)

(Composer version 2.5.5 2023-03-21 11:50:05, Ubuntu 22.04.LTS, PHP is installed from distribution.)

Steps to Reproduce

composer create-project codeigniter4/appstarter my_test_app

Expected Output

Uhm, composer not crashing? :-)

Anything else?

No response

kenjis commented 1 year ago

Cannot reproduce on my mac.

$ composer create-project codeigniter4/appstarter my_test_app
Creating a "codeigniter4/appstarter" project at "./my_test_app"
Installing codeigniter4/appstarter (v4.3.3)
  - Installing codeigniter4/appstarter (v4.3.3): Extracting archive
Created project in /Users/kenji/tmp/my_test_app
Loading composer repositories with package information
Updating dependencies
Lock file operations: 35 installs, 0 updates, 0 removals
  - Locking codeigniter4/framework (v4.3.3)
  - Locking doctrine/instantiator (2.0.0)
  - Locking fakerphp/faker (v1.21.0)
  - Locking laminas/laminas-escaper (2.12.0)
  - Locking mikey179/vfsstream (v1.6.11)
  - Locking myclabs/deep-copy (1.11.1)
  - Locking nikic/php-parser (v4.15.4)
  - Locking phar-io/manifest (2.0.3)
  - Locking phar-io/version (3.2.1)
  - Locking phpunit/php-code-coverage (9.2.26)
  - Locking phpunit/php-file-iterator (3.0.6)
  - Locking phpunit/php-invoker (3.1.1)
  - Locking phpunit/php-text-template (2.0.4)
  - Locking phpunit/php-timer (5.0.3)
  - Locking phpunit/phpunit (9.6.6)
  - Locking psr/container (2.0.2)
  - Locking psr/log (1.1.4)
  - Locking sebastian/cli-parser (1.0.1)
  - Locking sebastian/code-unit (1.0.8)
  - Locking sebastian/code-unit-reverse-lookup (2.0.3)
  - Locking sebastian/comparator (4.0.8)
  - Locking sebastian/complexity (2.0.2)
  - Locking sebastian/diff (4.0.4)
  - Locking sebastian/environment (5.1.5)
  - Locking sebastian/exporter (4.0.5)
  - Locking sebastian/global-state (5.0.5)
  - Locking sebastian/lines-of-code (1.0.3)
  - Locking sebastian/object-enumerator (4.0.4)
  - Locking sebastian/object-reflector (2.0.4)
  - Locking sebastian/recursion-context (4.0.5)
  - Locking sebastian/resource-operations (3.0.3)
  - Locking sebastian/type (3.2.1)
  - Locking sebastian/version (3.0.2)
  - Locking symfony/deprecation-contracts (v3.2.1)
  - Locking theseer/tokenizer (1.2.1)
Writing lock file
Installing dependencies from lock file (including require-dev)
Package operations: 35 installs, 0 updates, 0 removals
  - Installing psr/log (1.1.4): Extracting archive
  - Installing laminas/laminas-escaper (2.12.0): Extracting archive
  - Installing codeigniter4/framework (v4.3.3): Extracting archive
  - Installing symfony/deprecation-contracts (v3.2.1): Extracting archive
  - Installing psr/container (2.0.2): Extracting archive
  - Installing fakerphp/faker (v1.21.0): Extracting archive
  - Installing mikey179/vfsstream (v1.6.11): Extracting archive
  - Installing sebastian/version (3.0.2): Extracting archive
  - Installing sebastian/type (3.2.1): Extracting archive
  - Installing sebastian/resource-operations (3.0.3): Extracting archive
  - Installing sebastian/recursion-context (4.0.5): Extracting archive
  - Installing sebastian/object-reflector (2.0.4): Extracting archive
  - Installing sebastian/object-enumerator (4.0.4): Extracting archive
  - Installing sebastian/global-state (5.0.5): Extracting archive
  - Installing sebastian/exporter (4.0.5): Extracting archive
  - Installing sebastian/environment (5.1.5): Extracting archive
  - Installing sebastian/diff (4.0.4): Extracting archive
  - Installing sebastian/comparator (4.0.8): Extracting archive
  - Installing sebastian/code-unit (1.0.8): Extracting archive
  - Installing sebastian/cli-parser (1.0.1): Extracting archive
  - Installing phpunit/php-timer (5.0.3): Extracting archive
  - Installing phpunit/php-text-template (2.0.4): Extracting archive
  - Installing phpunit/php-invoker (3.1.1): Extracting archive
  - Installing phpunit/php-file-iterator (3.0.6): Extracting archive
  - Installing theseer/tokenizer (1.2.1): Extracting archive
  - Installing nikic/php-parser (v4.15.4): Extracting archive
  - Installing sebastian/lines-of-code (1.0.3): Extracting archive
  - Installing sebastian/complexity (2.0.2): Extracting archive
  - Installing sebastian/code-unit-reverse-lookup (2.0.3): Extracting archive
  - Installing phpunit/php-code-coverage (9.2.26): Extracting archive
  - Installing phar-io/version (3.2.1): Extracting archive
  - Installing phar-io/manifest (2.0.3): Extracting archive
  - Installing myclabs/deep-copy (1.11.1): Extracting archive
  - Installing doctrine/instantiator (2.0.0): Extracting archive
  - Installing phpunit/phpunit (9.6.6): Extracting archive
5 package suggestions were added by new dependencies, use `composer suggest` to see details.
Generating optimized autoload files
27 packages you are using are looking for funding.
Use the `composer fund` command to find out more!
infection/extension-installer: No extensions found
No security vulnerability advisories found
joho1968 commented 1 year ago

Well, I wouldn't have expected this to pass release tests, I'm merely reporting it. What's odd is that doing a "composer update" seems to "fill in the blanks". Either that, or I haven't gotten to any broken parts in the tutorial yet.

ddevsr commented 1 year ago

You already git clone and running composer create-project?

ddevsr commented 1 year ago

@joho1968 Send your composer.json to here please

joho1968 commented 1 year ago

You already git clone and running composer create-project?

No, I'm following the tutorial.

joho1968 commented 1 year ago

Here's the text from the tutorial:

"App Starter

The CodeIgniter 4 app starter repository holds a skeleton application, with a composer dependency on the latest released version of the framework.

This installation technique would suit a developer who wishes to start a new CodeIgniter4 based project."

Installation

In the folder above your project root: composer create-project codeigniter4/appstarter project-root The command above will create a project-root folder."

So maybe I'm misreading this, but I'm assuming the appstarter will pull the required framework files, etc and then I'll have a complete environment. This is where it segfaults.

This is what I type:

composer create-project codeigniter4/appstarter project-root

This is what I get:

Creating a "codeigniter4/appstarter" project at "./project-root"
Info from https://repo.packagist.org: #StandWithUkraine
Installing codeigniter4/appstarter (v4.3.3)
  - Installing codeigniter4/appstarter (v4.3.3): Extracting archive
Created project in /var/www/ltest2/project-root
Loading composer repositories with package information
Segmentation fault (core dumped)

Now, if I go into .project-root, and do composer update, it finishes properly.

joho1968 commented 1 year ago

composer.json, as created during the first run (the one that segfaults):

{
    "name": "codeigniter4/appstarter",
    "type": "project",
    "description": "CodeIgniter4 starter app",
    "homepage": "https://codeigniter.com",
    "license": "MIT",
    "require": {
        "php": "^7.4 || ^8.0",
        "codeigniter4/framework": "^4.0"
    },
    "require-dev": {
        "fakerphp/faker": "^1.9",
        "mikey179/vfsstream": "^1.6",
        "phpunit/phpunit": "^9.1"
    },
    "config": {
        "optimize-autoloader": true,
        "preferred-install": "dist",
        "sort-packages": true
    },
    "autoload": {
        "exclude-from-classmap": [
            "**/Database/Migrations/**"
        ]
    },
    "autoload-dev": {
        "psr-4": {
            "Tests\\Support\\": "tests/_support"
        }
    },
    "scripts": {
        "test": "phpunit"
    },
    "support": {
        "forum": "https://forum.codeigniter.com/",
        "source": "https://github.com/codeigniter4/CodeIgniter4",
        "slack": "https://codeigniterchat.slack.com"
    }
}
kenjis commented 1 year ago

It seems this is an issue in your PHP. At least this is not a bug in CI4.

A PHP extension may cause the error.

joho1968 commented 1 year ago

Sure, that could be the case. But OTOH, doing a composer update finishes the task without a core dump/segfault. Well, like I initially said, I'm just reporting this in case it's happened before or something to be aware of.

It's a stock Ubuntu 22.04.LTS VPS installation with PHP 8.1.x (including extensions) from Ubuntu. So if there's something wrong with PHP, I'd say there are a lot of environments suffering from the same issue(s).

kenjis commented 1 year ago

Cannot reproduce.

$ /usr/bin/composer create-project codeigniter4/appstarter my_test_app
Creating a "codeigniter4/appstarter" project at "./my_test_app"
Info from https://repo.packagist.org: #StandWithUkraine
Installing codeigniter4/appstarter (v4.3.7)
  - Installing codeigniter4/appstarter (v4.3.7): Extracting archive
Created project in /home/kenji/tmp/my_test_app
Loading composer repositories with package information
Updating dependencies
Lock file operations: 35 installs, 0 updates, 0 removals
  - Locking codeigniter4/framework (v4.3.7)
  - Locking doctrine/instantiator (2.0.0)
  - Locking fakerphp/faker (v1.23.0)
  - Locking laminas/laminas-escaper (2.12.0)
  - Locking mikey179/vfsstream (v1.6.11)
  - Locking myclabs/deep-copy (1.11.1)
  - Locking nikic/php-parser (v4.16.0)
  - Locking phar-io/manifest (2.0.3)
  - Locking phar-io/version (3.2.1)
  - Locking phpunit/php-code-coverage (9.2.27)
  - Locking phpunit/php-file-iterator (3.0.6)
  - Locking phpunit/php-invoker (3.1.1)
  - Locking phpunit/php-text-template (2.0.4)
  - Locking phpunit/php-timer (5.0.3)
  - Locking phpunit/phpunit (9.6.10)
  - Locking psr/container (2.0.2)
  - Locking psr/log (1.1.4)
  - Locking sebastian/cli-parser (1.0.1)
  - Locking sebastian/code-unit (1.0.8)
  - Locking sebastian/code-unit-reverse-lookup (2.0.3)
  - Locking sebastian/comparator (4.0.8)
  - Locking sebastian/complexity (2.0.2)
  - Locking sebastian/diff (4.0.5)
  - Locking sebastian/environment (5.1.5)
  - Locking sebastian/exporter (4.0.5)
  - Locking sebastian/global-state (5.0.6)
  - Locking sebastian/lines-of-code (1.0.3)
  - Locking sebastian/object-enumerator (4.0.4)
  - Locking sebastian/object-reflector (2.0.4)
  - Locking sebastian/recursion-context (4.0.5)
  - Locking sebastian/resource-operations (3.0.3)
  - Locking sebastian/type (3.2.1)
  - Locking sebastian/version (3.0.2)
  - Locking symfony/deprecation-contracts (v3.3.0)
  - Locking theseer/tokenizer (1.2.1)
Writing lock file
Installing dependencies from lock file (including require-dev)
Package operations: 35 installs, 0 updates, 0 removals
  - Installing psr/log (1.1.4): Extracting archive
  - Installing laminas/laminas-escaper (2.12.0): Extracting archive
  - Installing codeigniter4/framework (v4.3.7): Extracting archive
  - Installing symfony/deprecation-contracts (v3.3.0): Extracting archive
  - Installing psr/container (2.0.2): Extracting archive
  - Installing fakerphp/faker (v1.23.0): Extracting archive
  - Installing mikey179/vfsstream (v1.6.11): Extracting archive
  - Installing sebastian/version (3.0.2): Extracting archive
  - Installing sebastian/type (3.2.1): Extracting archive
  - Installing sebastian/resource-operations (3.0.3): Extracting archive
  - Installing sebastian/recursion-context (4.0.5): Extracting archive
  - Installing sebastian/object-reflector (2.0.4): Extracting archive
  - Installing sebastian/object-enumerator (4.0.4): Extracting archive
  - Installing sebastian/global-state (5.0.6): Extracting archive
  - Installing sebastian/exporter (4.0.5): Extracting archive
  - Installing sebastian/environment (5.1.5): Extracting archive
  - Installing sebastian/diff (4.0.5): Extracting archive
  - Installing sebastian/comparator (4.0.8): Extracting archive
  - Installing sebastian/code-unit (1.0.8): Extracting archive
  - Installing sebastian/cli-parser (1.0.1): Extracting archive
  - Installing phpunit/php-timer (5.0.3): Extracting archive
  - Installing phpunit/php-text-template (2.0.4): Extracting archive
  - Installing phpunit/php-invoker (3.1.1): Extracting archive
  - Installing phpunit/php-file-iterator (3.0.6): Extracting archive
  - Installing theseer/tokenizer (1.2.1): Extracting archive
  - Installing nikic/php-parser (v4.16.0): Extracting archive
  - Installing sebastian/lines-of-code (1.0.3): Extracting archive
  - Installing sebastian/complexity (2.0.2): Extracting archive
  - Installing sebastian/code-unit-reverse-lookup (2.0.3): Extracting archive
  - Installing phpunit/php-code-coverage (9.2.27): Extracting archive
  - Installing phar-io/version (3.2.1): Extracting archive
  - Installing phar-io/manifest (2.0.3): Extracting archive
  - Installing myclabs/deep-copy (1.11.1): Extracting archive
  - Installing doctrine/instantiator (2.0.0): Extracting archive
  - Installing phpunit/phpunit (9.6.10): Extracting archive
13 package suggestions were added by new dependencies, use `composer suggest` to see details.
Generating optimized autoload files
27 packages you are using are looking for funding.
Use the `composer fund` command to find out more!
$ /usr/bin/composer --version
Composer 2.2.6 2022-02-04 17:00:38
$ cat /etc/lsb-release 
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=22.04
DISTRIB_CODENAME=jammy
DISTRIB_DESCRIPTION="Ubuntu 22.04.2 LTS"