Skip to content

Undefined constant "intval" when upgrading from YOURLS 1.8 (or prior) to 1.9 #3331

@ozh

Description

@ozh

If you get :

Fatal error: Uncaught Error: Undefined constant "intval" in <mydirectory>/admin/upgrade.php:32
Stack trace: #0 {main} thrown in <mydirectory>/admin/upgrade.php on line 32

Edit admin/upgrade.php on that line 32 and change

$oldsql = (intval)($_GET['oldsql']);

to

$oldsql = intval($_GET['oldsql']);

(remove parenthesis around intval)

This won't affect people who regularly update YOURLS, only people who are several releases late. If you encounter this issue please add a 👍 to this issue (upper right here, click on the little face next to the three dots) so I can evaluate if this worth a YOURLS release just for this or not. Thanks!

Discussed in https://github.com/orgs/YOURLS/discussions/3330

Originally posted by adamesq May 7, 2022
I cannot figure out this one: Undefined constant "intval"

I tried updating. Followed directions and replaced files in the root, then even dug down and made sure updates were made. I updated PHP to 8.0 (it was too low). I then was prompted to update (Upgrade YOURLS Your current installation needs to be upgraded.), but Yourls is already showing 1.9. When I hit the "Update" button (which shouldn't be necessary since I manually updated, I get:

Fatal error: Uncaught Error: Undefined constant "intval" in /admin/upgrade.php:32 Stack trace: #0 {main} thrown in /admin/upgrade.php on line 32

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions