Skip to content
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

Use of undefined constant HTTP_OK - assumed 'HTTP_OK' (this will throw an Error in a future version of PHP) #1065

Closed
reshaelfianur opened this issue Jan 23, 2020 · 15 comments
Labels
bug Something isn't working

Comments

@reshaelfianur
Copy link

i change $config['rest_enable_keys'] = true; in src/rest.php
and i get this error

Screenshot from 2020-01-23 15-32-26

I used jwt for token authentication but there were no problems there.

if i changing the config file nothing happens, logs and key doesn't working.
im using php version 7.3.1.

Screenshot from 2020-01-23 15-41-30

in the version that does not use vendor there are no problems

Thanks Sir

@georgebgr
Copy link

Please use self::HTTP_XXXX in RestController.php.
Chris, could you please merge and upload?

@IcarusHU
Copy link

He has already uploaded it, only the composer doesn't update to the right version... for months now :|

@IcarusHU
Copy link

What is pretty annoying, because I have 4 instances in local/dev/stage/master env, so I have to copy this file 16 cases manually on every deployment...

@joelkennedy
Copy link

@chriskacerguis are you planning to make a release any time soon which will contain this fix?

@tewfik-dj
Copy link

Thanks for the pointer !

@nerdv2
Copy link

nerdv2 commented Mar 12, 2020

As a workaround for composer, you could set the value to "dev-master" in composer.json for now until the latest fixes updated to packagist.

@aderowbotham
Copy link

I get this error after installing this, before making any changes to the config. So basically there's an error out of the box

Message: Use of undefined constant HTTP_OK - assumed 'HTTP_OK' (this will throw an Error in a future version of PHP) Filename: src/RestController.php Line Number: 659

Changing line 659 as follows...

$http_code > 0 || $http_code = self::HTTP_OK

...causes a further error Undefined property: Status::$http_status on line 542

@aderowbotham
Copy link

Thanks @nerdv2 - setting the version to "dev-master" resolves this

@AlfanMudhofir
Copy link

AlfanMudhofir commented Apr 12, 2020

I have same problem like @aderowbotham. I think there is some issues with some code in RestController.php. Then I try to changes the code at the line 659

From :
$http_code > 0 || $http_code = HTTP_OK;

To :
$http_code > 0 || $http_code = 200;

And I do change several code because I think that type of code is no longer supported on PHP 7. It's working well like I'm expected it would be. Please correct me if I was wrong.

@AlfanMudhofir
Copy link

i change $config['rest_enable_keys'] = true; in src/rest.php
and i get this error

Screenshot from 2020-01-23 15-32-26

I used jwt for token authentication but there were no problems there.

if i changing the config file nothing happens, logs and key doesn't working.
im using php version 7.3.1.

Screenshot from 2020-01-23 15-41-30

in the version that does not use vendor there are no problems

Thanks Sir

Like in this case, I change it from

        $this->response([
            $this->config->item('rest_status_field_name')  => false,
            $this->config->item('rest_message_field_name') => sprintf($this->lang->line('text_rest_invalid_api_key'), $this->rest->key),
        ], HTTP_FORBIDDEN);
    }

Into this :

        $this->response([
            $this->config->item('rest_status_field_name')  => false,
            $this->config->item('rest_message_field_name') => sprintf($this->lang->line('text_rest_invalid_api_key'), $this->rest->key),
        ], 403);

@r00ts3ctors
Copy link

@AlfanMudhofir sudah selesai masalahnya

@r00ts3ctors
Copy link

I get some error lik @AlfanMudhofir and @aderowbotham

and i try to chenge config/rest.php $config['rest_enable_keys'] = TRUE; i used PHP 7.2.27

@r00ts3ctors
Copy link

r00ts3ctors commented Apr 16, 2020

        $this->response([
            $this->config->item('rest_status_field_name')  => false,
            $this->config->item('rest_message_field_name') => sprintf($this->lang->line('text_rest_invalid_api_key'), $this->rest->key),
        ], self::HTTP_FORBIDDEN);); // 	HTTP_FORBIDDEN
    }

That is i chenge it on RestController

@chriskacerguis
Copy link
Owner

should be fixed now.

@chriskacerguis chriskacerguis added the bug Something isn't working label Aug 15, 2020
@kwul0208
Copy link

it works, thanks..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests