Code Monkey home page Code Monkey logo

Comments (4)

terrafrost avatar terrafrost commented on September 15, 2024

What version of mcrypt_compat are you using? From the most recent commit from the 1.0.14 release:

mcrypt_compat/lib/mcrypt.php

Lines 1253 to 1254 in e38b76f

#[\ReturnTypeWillChange]
public function onClose()

That should prevent the deprecation warning.

For good measure I just tested it out. With #[\ReturnTypeWillChange] I did not get the warning, without it I did.

from mcrypt_compat.

aszenz avatar aszenz commented on September 15, 2024

The latest version i see is 2.0.3 on Github, installing 2.0.3 shows the same error. When i add @return void to the method, the error goes away, not sure what is the reason, i'm getting the deprecation message when running tests via phpunit

from mcrypt_compat.

terrafrost avatar terrafrost commented on September 15, 2024

Can you share the output of your php -i?

What you're describing just doesn't jibe. So I created the following script:

<?php

class DemoFilter extends php_user_filter
{
    #[\ReturnTypeWillChange]
    public function filter($in, $out, &$consumed, $closing)
    {
    }

    /**
     * @return void
     */
    public function onCreate()
    {
    }

    public function onClose()
    {
    }
}

Here it's being ran on PHP 8.1: https://3v4l.org/kaChc

The output is as follows:

Deprecated: Return type of DemoFilter::onCreate() should either be compatible with php_user_filter::onCreate(): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /in/kaChc on line 13

Deprecated: Return type of DemoFilter::onClose() should either be compatible with php_user_filter::onClose(): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /in/kaChc on line 17

ie. the only line that doesn't result in a Deprecated warning is the one that's doing #[\ReturnTypeWillChange]. I'm guessing on yours it'd be the one that's doing @return void?

I mean, I can do @return void but I want to better understand the problem, first. Like what if this is an Ubuntu modified PHP version? In that scenario a bug report against the Ubuntu package maintainer might be appropriate in addition to doing @return void.

from mcrypt_compat.

aszenz avatar aszenz commented on September 15, 2024

Thanks, I tried this in an isolated project and there is no deprecation for #[ReturnTypeWillChange] attribute while there is one for annotation.

from mcrypt_compat.

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.