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 CHARSET_NATIVE" warning (php 7.2 issue) #583

Closed
hannob opened this Issue Oct 5, 2018 · 5 comments

Comments

Projects
None yet
2 participants
@hannob
Copy link
Contributor

hannob commented Oct 5, 2018

After a fresh installation of serendipity 2.2.1-alpha1 with PHP 7.2 entering the start page gives me a warning:

Warning: Use of undefined constant CHARSET_NATIVE - assumed 'CHARSET_NATIVE' (this will throw an Error in a future version of PHP) in [path]/serendipity_config.inc.php on line 403.

Subsequently there's also a stack trace due to production mode.

I am quite confused why this happens. The code is this:

$serendipity['charsets'] = array(
    'UTF-8/' => 'UTF-8',
    ''        => (defined('CHARSET_NATIVE') ? CHARSET_NATIVE : 'CHARSET_NATIVE')
);

This seems alright - CHARSET_NATIVE is only accessed if it's defined. I'm also unable to reproduce this in a minimized example.

@onli onli added the bugs label Oct 7, 2018

@onli

This comment has been minimized.

Copy link
Member

onli commented Oct 7, 2018

Hm, https://github.com/s9y/Serendipity/blob/master/serendipity_config.inc.php#L401 just calls the constant:

// Reset charset definition now that final language is known
$serendipity['charsets'] = array(
    'UTF-8/' => 'UTF-8',
    ''        => CHARSET_NATIVE
);

That's probably the issue?

The code you cite is from https://github.com/s9y/Serendipity/blob/master/serendipity_config.inc.php#L199, further above.

@hannob

This comment has been minimized.

Copy link
Contributor

hannob commented Oct 7, 2018

oh okay, that explains things. probably have just searched for it without checking that I'm in the right line number.

@hannob

This comment has been minimized.

Copy link
Contributor

hannob commented Oct 7, 2018

so there's something else strange, the installation seems to fail for other reasons and this is just a followup error.
Not sure this is something you even want to fix, obviously you can copy over the defined()?-stuff from the other place, but in normal installations this probably shouldn't be undefined anyway.

@onli

This comment has been minimized.

Copy link
Member

onli commented Oct 7, 2018

I'm not sure this can never happen in a normal situation, so I copied the defined() condition over.

@hannob

This comment has been minimized.

Copy link
Contributor

hannob commented Dec 16, 2018

I think we're done here.

@hannob hannob closed this Dec 16, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment