Bug #73407 [NEW]: mb_convert_variables() corrupts class definition
| From: | alexey dot loskutov at corp dot oft-e dot com | Date: | Fri, 28 Oct 2016 06:45:51 +0000 |
| Subject: | Bug #73407 [NEW]: mb_convert_variables() corrupts class definition | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-205047@lists.php.net to get a copy of this message | ||
From: alexey dot loskutov at corp dot oft-e dot com
Operating system: ubuntu 16.04 x64
PHP version: 5.6.27
Package: mbstring related
Bug Type: Bug
Bug description:mb_convert_variables() corrupts class definition
Description:
------------
If we apply mb_convert_variables on class which have array properties
next created object of this class have been corrupted default value of
array properties.
Also if we set property of another class by object of 1st class and
apply mb_convert_variables on 2nd class next created object of 1st class
have been corrupted values of array properties too.
Test script:
---------------
# example 1
class A {
public $prop = [1,2,3];
}
class B{
public $someProp;
}
$a = new A;
$b = new B;
$b->someProp = $a->prop;
mb_convert_variables('UTF-8', 'CP1252', $b);
$a = new A;
print_r($a);
# example 2
class C {
public $prop = ['string', 'string2'];
}
$c = new C;
mb_convert_variables('UTF-8', 'CP1252', $c);
$c = new C;
print_r($c);
Expected result:
----------------
A Object
(
[prop] => Array
(
[0] => 1
[1] => 2
[2] => 3
)
)
C Object
(
[prop] => Array
(
[0] => string
[1] => string2
)
)
Actual result:
--------------
A Object
(
[prop] => Array
*RECURSION*
)
C Object
(
[prop] => Array
*RECURSION*
)
--
Edit bug report at https://bugs.php.net/bug.php?id=73407&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=73407&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=73407&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=73407&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=73407&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=73407&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=73407&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=73407&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=73407&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=73407&r=support
Expected behavior: https://bugs.php.net/fix.php?id=73407&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=73407&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=73407&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=73407&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=73407&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=73407&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=73407&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=73407&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=73407&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=73407&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=73407&r=mysqlcfg