phalcon / cphalcon

High performance, full-stack PHP framework delivered as a C extension.
https://phalcon.io
BSD 3-Clause "New" or "Revised" License
10.79k stars 1.97k forks source link

[BUG]: Route Handling Not Working on PHP 8.3 #16510

Open kgrammer opened 9 months ago

kgrammer commented 9 months ago

Describe the bug When updating to PHP 8.3, routes that worked fine on PHP 8.2 no longer work.

I have been able to verify the issue by running the "Hello/Sign Up" tutorial code. When run on PHP 8.2, the tutorial code works as expected. When the tutorial code is run on PHP 8.3, the hello page is replaced with a 503 error screen. This failure screen can be seen at pt.bucketlynx.com.

To Reproduce Install and execute the hello/sign up tutorial code on a PHP 8.3 server.

Expected behavior The expected behavior for the routes to function corrected as they functioned on PHP 8.3. For the tutorial, it should display the "Hello" page with the name and email input fields, then allow input. That input should be added to the tutorial's database and on the Hello screen.

Details

[PHP Modules] apcu bcmath bz2 calendar Core ctype curl date dom exif FFI fileinfo filter ftp gd gettext hash iconv imagick intl json libxml mbstring mysqli mysqlnd openssl pcntl pcre PDO pdo_mysql phalcon Phar posix random readline Reflection session shmop SimpleXML soap sockets sodium SPL standard sysvmsg sysvsem sysvshm tidy tokenizer xml xmlreader xmlwriter xsl yaml Zend OPcache zephir_parser zip zlib

[Zend Modules] Zend OPcache

There Apache log file only shows:

The error log file shows:

[Fri Jan 12 11:44:37.439855 2024] AH01067: Failed to read FastCGI header [Fri Jan 12 11:44:37.439903 2024] AH01075: Error dispatching request to : [Fri Jan 12 11:44:37.482477 2024] AH01067: Failed to read FastCGI header, referer https://pt.bucketlynx.com/ [Fri Jan 12 11:44:37.482510 2024] AH01075: Error dispatching request to : , referer https://pt.bucketlynx.com/

kgrammer commented 9 months ago

Noted the following errors in the /var/log/php8.3-fpm.log file:

[12-Jan-2024 11:52:51] WARNING: [pool pt] child 66026 exited with code 127 after 0.007247 seconds from start [12-Jan-2024 11:52:51] NOTICE: [pool pt] child 66027 started [12-Jan-2024 11:52:51] WARNING: [pool pt] child 66027 exited with code 127 after 0.048859 seconds from start [12-Jan-2024 11:52:51] NOTICE: [pool pt] child 66028 started

kgrammer commented 9 months ago

I edited the Tutorial file IndexController.php and commented out " $this->view->users = Users::find();" line and the page loads.

Of course this means that the database records are not loaded, but the route isn't broken now so the "Hello" page is loading. I'm not getting the 127 errors above in php8.3-fpm.log either.

I then edited Users.php and added:

public function initialize(){
    error_log('***** initialize called *****' . PHP_EOL);
}

That code is not firing. This implies that the Users.php model is not being properly loaded which is, of coutrse, supported by the fact that when I comment out the find() call, the page loads.

kgrammer commented 9 months ago

It's worth noting that when I commented out the find(), and the register page is displayed, when I enter the name and email address, they ARE being added to the database table. So the save() is working as expected.

niden commented 9 months ago

@kgrammer If you do not use the model and find() and say you use the builder, do you see the same results? I am trying to reproduce this here on my local but am not having much success. There are warnings in the logs from the dynamic properties but that is it.

kgrammer commented 9 months ago

@niden Are you referring to the query builder? If so, no... I haven't tried that because I have a LOT of code across a half dozen products and I can't change away from find() at this point.

My first assumption is that some exec command in the Phalcon code that was OK in PHP 8.2 is missing or was moved after the PHP 8.3 update. This assumption is based in the 127 errors being logged in the php8.3-fpm log file.

kgrammer commented 9 months ago

@niden and I worked on the issue this evening and determined that the PECL build method works, but there is an issue with the compile build method. When building using the compile method, I have the problem.

@niden is going to rebuild Phalcon on his test system using the compile build method to confirm my findings.

If confirmed, this would mean the compile build method now has a new problem that wasn't present when building for PHP 8.2.