laravel / tinker

Powerful REPL for the Laravel framework.
https://laravel.com/docs/artisan#tinker
MIT License
7.34k stars 130 forks source link

ErrorException with message 'Unbinding $this of closure is deprecated' On php7.4 #83

Closed allowing closed 4 years ago

allowing commented 4 years ago

image

bobthecow commented 4 years ago

I'm not able to reproduce this, and I can't tell from current code where we might be causing it. Do you mind pasting the output of composer info? That might help track it down.

allowing commented 4 years ago
vagrant@homestead:~/code/school$ composer info
barryvdh/laravel-ide-helper           v2.6.5     Laravel IDE Helper, generates correct PHPDocs for all Facade classes, to improve auto-completion.
barryvdh/reflection-docblock          v2.0.6
composer/ca-bundle                    1.2.4      Lets you find a path to the system CA bundle, and includes a fallback to the Mozilla CA bundle.
composer/composer                     1.9.1      Composer helps you declare, manage and install dependencies of PHP projects. It ensures you have the right stack everywhere.
composer/semver                       1.5.0      Semver library that offers utilities, version constraint parsing and validation.
composer/spdx-licenses                1.5.2      SPDX licenses list and validation library.
composer/xdebug-handler               1.4.0      Restarts a process without Xdebug.
dnoegel/php-xdg-base-dir              0.1        implementation of xdg base directory specification for php
doctrine/cache                        1.10.0     PHP Doctrine Cache library is a popular cache implementation that supports many different drivers such as redis, memcache, apc, mongodb ...
doctrine/dbal                         v2.10.0    Powerful PHP database abstraction layer (DBAL) with many features for database schema introspection and management.
doctrine/event-manager                1.1.0      The Doctrine Event Manager is a simple PHP event system that was built to be used with the various Doctrine projects.
doctrine/inflector                    1.3.1      Common String Manipulations with regard to casing and singular/plural rules.
doctrine/instantiator                 1.3.0      A small, lightweight utility to instantiate objects in PHP without invoking their constructors
doctrine/lexer                        1.2.0      PHP Doctrine Lexer parser library that can be used in Top-Down, Recursive Descent Parsers.
dragonmantank/cron-expression         v2.3.0     CRON for PHP: Calculate the next or previous run date and determine if a CRON expression is due
egulias/email-validator               2.1.11     A library for validating emails against several RFCs
erusev/parsedown                      1.7.3      Parser for Markdown.
facade/flare-client-php               1.3.0      Send PHP errors to Flare
facade/ignition                       1.13.0     A beautiful error page for Laravel applications.
facade/ignition-contracts             1.0.0      Solution contracts for Ignition
fideloper/proxy                       4.2.1      Set trusted proxies for Laravel
filp/whoops                           2.5.0      php error handling for cool kids
fzaninotto/faker                      v1.9.0     Faker is a PHP library that generates fake data for you.
hamcrest/hamcrest-php                 v2.0.0     This is the PHP port of Hamcrest Matchers
jakub-onderka/php-console-color       v0.2
jakub-onderka/php-console-highlighter v0.4       Highlight PHP code in terminal
justinrainbow/json-schema             5.2.9      A library to validate a json schema.
laravel/framework                     v6.6.0     The Laravel Framework.
laravel/telescope                     v2.1       An elegant debug assistant for the Laravel framework.
laravel/tinker                        v2.0.0     Powerful REPL for the Laravel framework.
lcobucci/jwt                          3.3.1      A simple library to work with JSON Web Token and JSON Web Signature
league/flysystem                      1.0.57     Filesystem abstraction: Many filesystems, one API.
mockery/mockery                       1.3.0      Mockery is a simple yet flexible PHP mock object framework
monolog/monolog                       2.0.1      Sends your logs to files, sockets, inboxes, databases and various web services
moontoast/math                        1.1.2      A mathematics library, providing functionality for large numbers
myclabs/deep-copy                     1.9.3      Create deep copies (clones) of your objects
namshi/jose                           7.2.3      JSON Object Signing and Encryption library for PHP.
nesbot/carbon                         2.27.0     An API extension for DateTime that supports 281 different languages.
nikic/php-parser                      v4.3.0     A PHP parser written in PHP
nunomaduro/collision                  v3.0.1     Cli error handling for console/command-line PHP applications.
opis/closure                          3.5.1      A library that can be used to serialize closures (anonymous functions) and arbitrary objects.
paragonie/random_compat               v9.99.99   PHP 5.x polyfill for random_bytes() and random_int() from PHP 7
phar-io/manifest                      1.0.3      Component for reading phar.io manifest information from a PHP Archive (PHAR)
phar-io/version                       2.0.1      Library for handling version information and constraints
phpdocumentor/reflection-common       2.0.0      Common reflection classes used by phpdocumentor to reflect the code structure
phpdocumentor/reflection-docblock     4.3.2      With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a...
phpdocumentor/type-resolver           1.0.1      A PSR-5 based resolver of Class names, Types and Structural Element Names
phpoption/phpoption                   1.6.0      Option Type for PHP
phpspec/prophecy                      1.9.0      Highly opinionated mocking framework for PHP 5.3+
phpunit/php-code-coverage             7.0.10     Library that provides collection, processing, and rendering functionality for PHP code coverage information.
phpunit/php-file-iterator             2.0.2      FilterIterator implementation that filters files based on a list of suffixes.
phpunit/php-text-template             1.2.1      Simple template engine.
phpunit/php-timer                     2.1.2      Utility class for timing
phpunit/php-token-stream              3.1.1      Wrapper around PHP's tokenizer extension.
phpunit/phpunit                       8.4.3      The PHP Unit Testing framework.
psr/container                         1.0.0      Common Container Interface (PHP FIG PSR-11)
psr/log                               1.1.2      Common interface for logging libraries
psr/simple-cache                      1.0.1      Common interfaces for simple caching
psy/psysh                             v0.9.11    An interactive shell for modern PHP.
ramsey/uuid                           3.9.1      Formerly rhumsaa/uuid. A PHP 5.4+ library for generating RFC 4122 version 1, 3, 4, and 5 universally unique identifiers (UUID).
scrivo/highlight.php                  v9.15.10.0 Server side syntax highlighter that supports 185 languages. It's a PHP port of highlight.js
sebastian/code-unit-reverse-lookup    1.0.1      Looks up which function or method a line of code belongs to
sebastian/comparator                  3.0.2      Provides the functionality to compare PHP values for equality
sebastian/diff                        3.0.2      Diff implementation
sebastian/environment                 4.2.3      Provides functionality to handle HHVM/PHP environments
sebastian/exporter                    3.1.2      Provides the functionality to export PHP variables for visualization
sebastian/global-state                3.0.0      Snapshotting of global state
sebastian/object-enumerator           3.0.3      Traverses array structures and object graphs to enumerate all referenced objects
sebastian/object-reflector            1.1.1      Allows reflection of object attributes, including inherited and non-public ones
sebastian/recursion-context           3.0.0      Provides functionality to recursively process PHP variables
sebastian/resource-operations         2.0.1      Provides a list of PHP built-in functions that operate on resources
sebastian/type                        1.1.3      Collection of value objects that represent the types of the PHP type system
sebastian/version                     2.0.1      Library that helps with managing the version number of Git-hosted PHP projects
seld/jsonlint                         1.7.2      JSON Linter
seld/phar-utils                       1.0.1      PHAR file format utilities, for when PHP phars you up
swiftmailer/swiftmailer               v6.2.3     Swiftmailer, free feature-rich PHP mailer
symfony/console                       v4.4.1     Symfony Console Component
symfony/css-selector                  v5.0.1     Symfony CssSelector Component
symfony/debug                         v4.4.1     Symfony Debug Component
symfony/error-handler                 v4.4.1     Symfony ErrorHandler Component
symfony/event-dispatcher              v4.4.1     Symfony EventDispatcher Component
symfony/event-dispatcher-contracts    v1.1.7     Generic abstractions related to dispatching event
symfony/filesystem                    v4.4.1     Symfony Filesystem Component
symfony/finder                        v4.4.1     Symfony Finder Component
symfony/http-foundation               v4.4.1     Symfony HttpFoundation Component
symfony/http-kernel                   v4.4.1     Symfony HttpKernel Component
symfony/mime                          v5.0.1     A library to manipulate MIME messages
symfony/polyfill-ctype                v1.13.1    Symfony polyfill for ctype functions
symfony/polyfill-iconv                v1.13.1    Symfony polyfill for the Iconv extension
symfony/polyfill-intl-idn             v1.13.1    Symfony polyfill for intl's idn_to_ascii and idn_to_utf8 functions
symfony/polyfill-mbstring             v1.13.1    Symfony polyfill for the Mbstring extension
symfony/polyfill-php56                v1.13.1    Symfony polyfill backporting some PHP 5.6+ features to lower PHP versions
symfony/polyfill-php72                v1.13.1    Symfony polyfill backporting some PHP 7.2+ features to lower PHP versions
symfony/polyfill-php73                v1.13.1    Symfony polyfill backporting some PHP 7.3+ features to lower PHP versions
symfony/polyfill-util                 v1.13.1    Symfony utilities for portability of PHP codes
symfony/process                       v4.4.1     Symfony Process Component
symfony/routing                       v4.4.1     Symfony Routing Component
symfony/service-contracts             v2.0.1     Generic abstractions related to writing services
symfony/translation                   v4.4.1     Symfony Translation Component
symfony/translation-contracts         v2.0.1     Generic abstractions related to translation
symfony/var-dumper                    v4.4.1     Symfony mechanism for exploring and dumping PHP variables
theseer/tokenizer                     1.1.3      A small library for converting tokenized PHP source code into XML and potentially other formats
tijsverkoyen/css-to-inline-styles     2.2.2      CssToInlineStyles is a class that enables you to convert HTML-pages/files into HTML-pages/files with inline styles. This is very useful ...
tymon/jwt-auth                        1.0.0-rc.5 JSON Web Token Authentication for Laravel and Lumen
vlucas/phpdotenv                      v3.6.0     Loads environment variables from `.env` to `getenv()`, `$_ENV` and `$_SERVER` automagically.
webmozart/assert                      1.6.0      Assertions to validate method input/output with nice error messages.
bobthecow commented 4 years ago

Hmm. Not seeing anything immediately wrong there. Does this happen with a freshly created Laravel project? Does it happen if you run vendor/bin/psysh directly?

driesvints commented 4 years ago

Please don't ignore the issue template when reporting bug and fill it in, thanks.

allowing commented 4 years ago

image

Looks like php 7.4

driesvints commented 4 years ago

@allowing can you please fill out the issue template?

allowing commented 4 years ago

Description:

PHP Deprecated:  Unbinding $this of closure is deprecated in /home/vagrant/code/school/vendor/psy/psysh/src/ExecutionClosure.php on line 85

Steps To Reproduce:

$ ./vendor/bin/psysh
bobthecow commented 4 years ago

My best guess is that this is a bug in 7.4.0beta4 which was fixed by 7.4.0. The closure it's complaining about unbinding $this in doesn't reference $this anywhere.

Here's PHP 7.4.0 complaining about a legitimate unbinding of $this, but letting everything else through without an issue:

Screen Shot 2019-12-06 at 9 40 44 PM
bobthecow commented 4 years ago

Oh! Here it is :)

https://github.com/php/php-src/commit/d1157cbce1

driesvints commented 4 years ago

PHP Version: 7.4.0beta4

@allowing this is exactly why you need to fill out the issue template. It makes it much more easier to get to the bottom of the problem. This was indeed resolved in a later PHP version by Nikita.

@bobthecow thanks for helping out on this one!