Bug #71856 [Opn->Fbk]: bug in webPhar and Closure::bind

From: Date: Wed, 27 Jan 2021 11:56:34 +0000
Subject: Bug #71856 [Opn->Fbk]: bug in webPhar and Closure::bind
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-231794@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=71856&edit=1 ID: 71856 Updated by: cmb@php.net Reported by: tuadmin at gmail dot com Summary: bug in webPhar and Closure::bind -Status: Open +Status: Feedback Type: Bug Package: PHAR related Operating System: linux,win32 PHP Version: 5.6.19 -Assigned To: +Assigned To: cmb Block user comment: N Private report: N New Comment: Is this still an issue with any of the actively supported PHP versions[1]? If so, please provide a minimal self-contained reproduce script. [1] <https://www.php.net/supported-versions.php> Previous Comments: ------------------------------------------------------------------------ [2016-03-19 06:03:35] tuadmin at gmail dot com for semi-patch or temporal solution in stub-web embed use... <?php function __temporal__solution__(){ require 'web.php'; } __temporal__solution__(); ------------------------------------------------------------------------ [2016-03-19 05:42:10] tuadmin at gmail dot com Description: ------------ <?php class myclass{ public $x; public function __construct($string){ $this->x=$string; } public function show(){ echo "this message is {$this->x}"; } } $func = function (){ $this->show(); }; $class = new myclass('hi this is example for bug'); $x = Closure::bind($func,$class); $x(); Test script: --------------- <?php class myclass{ public $x; public function __construct($string){ $this->x=$string; } public function show(){ echo "this message is {$this->x}"; } } $func = function (){ $this->show(); }; $class = new myclass('hi this is example for bug'); $x = Closure::bind($func,$class); $x(); Expected result: ---------------- this message is hi this is example for bug Actual result: -------------- Warning: Cannot bind an instance to a static closure in phar://var/www/test.phar/web.php on line 15 ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=71856&edit=1

« previous php.bugs (#231794) next »