Bug #71856 [Opn]: bug in webPhar and Closure::bind
| From: | tuadmin at gmail dot com | Date: | Sat, 19 Mar 2016 06:03:37 +0000 |
| Subject: | Bug #71856 [Opn]: bug in webPhar and Closure::bind | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-199937@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
User updated by: tuadmin at gmail dot com
Reported by: tuadmin at gmail dot com
Summary: bug in webPhar and Closure::bind
Status: Open
Type: Bug
Package: PHAR related
Operating System: linux,win32
PHP Version: 5.6.19
Block user comment: N
Private report: N
New Comment:
for semi-patch or temporal solution in stub-web embed use...
<?php
function __temporal__solution__(){
require 'web.php';
}
__temporal__solution__();
Previous Comments:
------------------------------------------------------------------------
[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