Git Product home page Git Product logo

Comments (1)

punyflash avatar punyflash commented on June 26, 2024

The PHP have a strange behavior for such syntax. Tested some stuff in sandbox and that's what I discovered:

PHP <= 7.4

<?php

$class = new (get_class(new Exception)));

Gives error:

Parse error: syntax error, unexpected '(' in test.php on line 4

Process exited with code 255.

However, it works for PHP => 8.0.

PHP 8.1

<?php

$class = new get_class(new Exception);

Gives error:

Fatal error: Uncaught Error: Class "get_class" not found in test.php:4
Stack trace:
#0 {main}
  thrown in /in/CPRRi on line 4

Process exited with code 255.

However, it works for PHP <= 8.0.

Fix

In version 2, the kernel object will be reworked, and the issue will be resolved by itself, but for now something like this will fix the issue:

$kernel = get_class($this->kernel);
$this->kernel = new $kernel;

Thanks for contribution!

from telebot.

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.