Git Product home page Git Product logo

Comments (9)

keradus avatar keradus commented on July 17, 2024 1
keradus@keradus:~$ php --version
PHP 7.1.0RC3 (cli) ( NTS )
Copyright (c) 1997-2016 The PHP Group
Zend Engine v3.1.0-dev, Copyright (c) 1998-2016 Zend Technologies
    with Zend OPcache v7.1.0RC3, Copyright (c) 1999-2016, by Zend Technologies
keradus@keradus:~$ php -m | grep mb
keradus@keradus:~$ php -r "var_dump(function_exists('mb_strlen'));"
bool(false)

from polyfill.

keradus avatar keradus commented on July 17, 2024 1

buahahaha :D good one ;)
maybe you should propose WP to use this polyfill, as it's more full ? (eg we have that mb_check_encoding)

from polyfill.

keradus avatar keradus commented on July 17, 2024

but all of this functions from this library still not defined.
I debug into the bootstrap.php and see that function_exists('mb_strlen'); returns true

so, your PHP claims it knows about mb_strlen function, so polyfill is working properly for you. The method is registered not by module, but via this polyfill.

from polyfill.

korobochkin avatar korobochkin commented on July 17, 2024

@keradus yes, I expect this behaviour. But instead I have fatal error :

Fatal error: Uncaught Error: Call to undefined function Symfony\Component\Validator\Constraints\mb_check_encoding() in /srv/www/wordpress-default/wp-content/plugins/setka-editor/vendor/symfony/validator/Constraints/LengthValidator.php on line 42

The code from my first message I writed directly in bootstrap.php before if (!function_exists('mb_strlen')). So right in bootstrap.php function_exists('mb_strlen') returns true but all of this functions such as mb_check_encoding() not defined because I don't have an extension (manually disabled) and if (!function_exists('mb_strlen')) statement working not as expected.

from polyfill.

korobochkin avatar korobochkin commented on July 17, 2024

Ah!. I understand what it is. As you can noticed before - I'm using this libraby (Symfony Validator) in WordPress. And WordPress have their own mb_strlen() in wp-includes/compat.php:

if ( ! function_exists( 'mb_strlen' ) ) :
    function mb_strlen( $str, $encoding = null ) {
        return _mb_strlen( $str, $encoding );
    }
endif;

Oh! Look like I'm in trouble :)

from polyfill.

korobochkin avatar korobochkin commented on July 17, 2024

@keradus Thank you for your suggestions :) Spent a few hours to prepare server with PHP 7.0 and all the environment similar to the "bug reported environment". And only after it thought to search for function mb_strlen in WordPress source code :)

I'd really like to WordPress used this and other Symfony packages (librarys) but it takes a long time for developement and older WordPress versions still unmodified (its bad for plugin developers who cares about backward compatibility).

from polyfill.

keradus avatar keradus commented on July 17, 2024

well. one way or another I think that this issue could be closed.

from polyfill.

korobochkin avatar korobochkin commented on July 17, 2024

Yes. Thank you for quick replies and support!

from polyfill.

keradus avatar keradus commented on July 17, 2024

glad to help !

from polyfill.

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.