php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #71856 bug in webPhar and Closure::bind
Submitted: 2016-03-19 05:42 UTC Modified: 2021-02-07 04:22 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: tuadmin at gmail dot com Assigned: cmb (profile)
Status: No Feedback Package: PHAR related
PHP Version: 5.6.19 OS: linux,win32
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: tuadmin at gmail dot com
New email:
PHP Version: OS:

 

 [2016-03-19 05:42 UTC] 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

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2016-03-19 06:03 UTC] 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__();
 [2021-01-27 11:56 UTC] cmb@php.net
-Status: Open +Status: Feedback -Assigned To: +Assigned To: cmb
 [2021-01-27 11:56 UTC] cmb@php.net
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>
 [2021-02-07 04:22 UTC] php-bugs at lists dot php dot net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Mar 28 13:01:28 2024 UTC