Giter Site home page Giter Site logo

Comments (6)

ikkez avatar ikkez commented on August 17, 2024 2

Hi. thanks for reporting this. I heard something similar recently, but your details are very good. Yes probably we should just add a check if the constant exists with defined() before accessing it and remove the @

from fatfree.

ikkez avatar ikkez commented on August 17, 2024

This is because "Latin" (la) is not part of the Windows compatible ISO-639-2 locale subset.

ref.: https://docs.moodle.org/dev/Table_of_locales#Table

we should probably review this and check if Win10+ can handle the unix type locales now.

from fatfree.

MissConstrued avatar MissConstrued commented on August 17, 2024

We have encountered this for the first time yesterday. The fix for this is a bit groky and I think the actual problem might still count as a bug(ish).

I come from South Africa and we have a number of local official languages. This issue was first reported by a user with isiZulu set as their browser langauge. I was able to replicate this problem by setting my browser language to isiXhosa - not an unreasonable thing for Zulu/Xhosa speakers to do. This triggered the following error:
Undefined constant ISO::LC_xh [F:\wamp64\www\rodel\trust.rodelfiduciary.co.za\vendor\bcosca\fatfree-core\base.php:1136]

This is derived from the 'Accept-Language' request header, which in my case is:
'xh-ZA,xh;q=0.8,en-US;q=0.5,en;q=0.3'

The error suppression at line 1136 doesn't work at my current version of PHP (8.0.20). I am not sure if it worked previously:
$locale=@constant('ISO::LC_'.$parts[0]);

The fix, which is not ideal, is to manually change the $_SERVER['HTTP_ACCEPT_LANGUAGE'] early on in the request (before you hit F3). For example:
$_SERVER['HTTP_ACCEPT_LANGUAGE'] = 'en-ZA,en';

I can't seem to find any other way around it. I would welcome a more robust solution if I missed it :-)

from fatfree.

geniuswebtools avatar geniuswebtools commented on August 17, 2024

@MissConstrued I was looking at the PHP 8 upgrade info, and noticed this:

The @ operator will no longer silence fatal errors (E_ERROR, E_CORE_ERROR, E_COMPILE_ERROR, E_USER_ERROR, E_RECOVERABLE_ERROR, E_PARSE). Error handlers that expect error_reporting to be 0 when @ is used, should be adjusted to use a mask check instead:

https://www.php.net/manual/en/migration80.incompatible.php

The constant() method will throw an error if the constant is not defined:
https://www.php.net/manual/en/function.constant.php

If the constant is not defined, an Error exception is thrown. Prior to PHP 8.0.0, an E_WARNING level error was generated in that case.

So in PHP 7 it probably didn't work either, but the supression did work.

from fatfree.

MissConstrued avatar MissConstrued commented on August 17, 2024

Great :-)

However, for anyone currently facing this issue (who doesn't want to edit base.php for the obvious reasons) a work around is to check and override $_SERVER['HTTP_ACCEPT_LANGUAGE'] before F3 instantiation.

from fatfree.

ikkez avatar ikkez commented on August 17, 2024

fixed

from fatfree.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.