php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #66964 mb_convert_variables() cannot detect recursion
Submitted: 2014-03-27 07:37 UTC Modified: 2016-09-06 10:36 UTC
Votes:11
Avg. Score:3.5 ± 1.3
Reproduced:7 of 9 (77.8%)
Same Version:5 (71.4%)
Same OS:3 (42.9%)
From: ryosuke_i_628 at yahoo dot co dot jp Assigned: yohgaki (profile)
Status: Closed Package: mbstring related
PHP Version: Irrelevant OS:
Private report: No CVE-ID: None
 [2014-03-27 07:37 UTC] ryosuke_i_628 at yahoo dot co dot jp
Description:
------------
mb_convert_variables() cannot detect recursion.
It should be able to detect like var_dump() or print_r().

Test script:
---------------
<?php
$a[] = &$a;
mb_convert_variables('utf-8', 'auto', $a);

Expected result:
----------------
Success with no outputs.

Actual result:
--------------
Fatal error:  Out of memory (allocated 542113792) (tried to allocate 541851648 bytes) in ... on line 3

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2014-07-06 01:52 UTC] yohgaki@php.net
-Status: Open +Status: Assigned -Assigned To: +Assigned To: yohgaki
 [2016-09-06 09:30 UTC] yohgaki@php.net
Automatic comment on behalf of yohgaki
Revision: http://git.php.net/?p=php-src.git;a=commit;h=a25f6f89cd68b5e3ba73381094771a011aec6f04
Log: Fixed Bug #66964 mb_convert_variables() cannot detect recursion
 [2016-09-06 09:30 UTC] yohgaki@php.net
-Status: Assigned +Status: Closed
 [2016-09-06 10:36 UTC] yohgaki@php.net
Modified to detect recursion.
However, it does not finish all conversions. It finishes conversion as soon as it detects recursion. This is due to the way recursion is handled currently. i.e. Recursion is handled non recursive calls.

To change this behavior, mb_convert_variables() has to be modified to use recursive call.
 [2016-10-17 10:08 UTC] bwoebi@php.net
Automatic comment on behalf of yohgaki
Revision: http://git.php.net/?p=php-src.git;a=commit;h=a25f6f89cd68b5e3ba73381094771a011aec6f04
Log: Fixed Bug #66964 mb_convert_variables() cannot detect recursion
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 14:01:32 2024 UTC