Bug #71856 [NEW]: bug in webPhar and Closure::bind
| From: | tuadmin at gmail dot com | Date: | Sat, 19 Mar 2016 05:42:12 +0000 |
| Subject: | Bug #71856 [NEW]: bug in webPhar and Closure::bind | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-199935@lists.php.net to get a copy of this message | ||
From: tuadmin at gmail dot com
Operating system: linux,win32
PHP version: 5.6.19
Package: PHAR related
Bug Type: Bug
Bug description:bug in webPhar and Closure::bind
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 bug report at https://bugs.php.net/bug.php?id=71856&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=71856&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=71856&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=71856&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=71856&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=71856&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=71856&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=71856&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=71856&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=71856&r=support
Expected behavior: https://bugs.php.net/fix.php?id=71856&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=71856&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=71856&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=71856&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=71856&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=71856&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=71856&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=71856&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=71856&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=71856&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=71856&r=mysqlcfg