php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #46273 Excess method call in var_export.
Submitted: 2008-10-10 22:39 UTC Modified: 2008-10-24 10:31 UTC
Votes:1
Avg. Score:3.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: serovov at gmail dot com Assigned:
Status: Closed Package: Scripting Engine problem
PHP Version: 5.2CVS-2008-10-10 (snap) OS: *
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 you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: serovov at gmail dot com
New email:
PHP Version: OS:

 

 [2008-10-10 22:39 UTC] serovov at gmail dot com
Description:
------------
I'm looked in code of var_export and found excess method call.
in ext/standart/var.c in method 


PHPAPI void php_var_export(zval **struc, int level TSRMLS_DC) /* {{{ */


We hava a switch:


switch (Z_TYPE_PP(struc)) {


And little bottom we have a case for array(php5.*/6) line ~407:


		break;
	case IS_ARRAY:
		myht = Z_ARRVAL_PP(struc);
		if (level > 1) {
			php_printf("\n%*c", level - 1, ' ');
		}
		PUTS ("array (\n");
		zend_hash_apply_with_arguments(myht TSRMLS_CC, (apply_func_args_t) php_array_element_export, 1, level, (Z_TYPE_PP(struc) == IS_ARRAY ? 0 : 1));



And We see, that the "Z_TYPE_PP(struc)" is aleready and always IS_ARRAY.
We must remove (Z_TYPE_PP(struc) == IS_ARRAY ? 0 : 1) and replace it to "0".
Have a nice day =)



Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-10-24 10:31 UTC] felipe@php.net
It's a macro.
Anyway, it has seen removed. Thanks.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Wed Jul 16 14:01:33 2025 UTC