codeigniter4 / CodeIgniter4

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

Bug: CURL request hanged while #7357

Closed sr13579 closed 1 year ago

sr13579 commented 1 year ago

PHP Version

8.2

CodeIgniter4 Version

4.3.2

CodeIgniter4 Installation Method

Composer (using codeigniter4/appstarter)

Which operating systems have you tested for this bug?

Linux

Which server did you use?

cli-server (PHP built-in webserver)

Database

MariaDB

What happened?

While working on CURL Request the page is hanged and loading. This is happening when sending post data. Didn't test for GET data. This is the workflow: 8080---POST--->8081 8081--->Response--->8080>>>>>>>Hanged>>>>>>......

Steps to Reproduce

Change the environment to development/testing and send a post request . Use two Codeigniter in same PC with two ports.

Expected Output

In the past versions the hanging never happened.

Anything else?

Forgot to add another thing. Deactivating Kint toolbar from Filter makes it normal. It is happening because of CI_DEBUG>true

kenjis commented 1 year ago

Can you show minimum code to reproduce?

You cannot use the environment testing.

The environment testing is the special one for PHPUnit testing. It has special conditions built into the framework at various places to assist with that. You can’t use it for your development. https://codeigniter4.github.io/CodeIgniter4/general/environments.html#the-environment-constant

sr13579 commented 1 year ago

Can you show minimum code to reproduce?

You cannot use the environment testing.

The environment testing is the special one for PHPUnit testing. It has special conditions built into the framework at various places to assist with that. You can’t use it for your development. https://codeigniter4.github.io/CodeIgniter4/general/environments.html#the-environment-constant

It is not the code that is doing it. Whatever the code is when I am trying to run Curl with Curl request class it won't work in development mode. But it had worked in the previous versions. If you still need the code : $client = \Config\Services::curlrequest();

$response = $client->request('POST', 'https://api.github.com/user', ['put data if necessery']);

kenjis commented 1 year ago

Cannot reproduce.

<?php

namespace App\Controllers;

class Home extends BaseController
{
    public function index()
    {
        $client = \Config\Services::curlrequest();
        $response = $client->request('POST', 'https://api.github.com/user', ['put data if necessery']);
    }
}

Result:

CodeIgniter\HTTP\Exceptions\HTTPException

22 : The requested URL returned error: 403 [search →](https://www.duckduckgo.com/?q=CodeIgniter%5CHTTP%5CExceptions%5CHTTPException+22+%3A+The+requested+URL+returned+error%3A+403)
sr13579 commented 1 year ago

I think this is a problem with my local environment.You may close the issue. But it is connected with defined('CI_DEBUG') || define('CI_DEBUG', true); When I make it false the request is not hanging anymore.

kenjis commented 1 year ago

You cannot show how to reproduce. Close.