php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #26571 func_get_arg(),func_get_args() fail to give value.
Submitted: 2003-12-09 21:23 UTC Modified: 2003-12-09 23:47 UTC
Votes:2
Avg. Score:1.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: Mentaloid at hotmail dot com Assigned:
Status: Not a bug Package: Scripting Engine problem
PHP Version: 4.3.3 OS: Linux 2.4.22 SMP
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: Mentaloid at hotmail dot com
New email:
PHP Version: OS:

 

 [2003-12-09 21:23 UTC] Mentaloid at hotmail dot com
Description:
------------
When passing a string containing 8 bytes that represents hexadecimal data such as 'ffffffff' to a user function that utilizes func_get_arg() or func_get_arg(), values become unavailable (zero length string) while func_num_args() will show that the value existed.

Configure Line "'./configure' '--with-mysql=/usr/local/mysql' '--with-ftp' '--enable-sockets' '--with-apxs2=/usr/local/apache2/bin/apxs'"

Apache 2.0, standard config + frontpage extensions. Frontpage extensions not active on this virtualhost.
Standard INI, with the exception of ASP TAGS.

PHPInfo page can be viewed @ http://tko.mentadd.com/ServerControl/control/xxPhpInfo.php

Reproduce code:
---------------
function binlogdata() {
	global $DB, $scbinlogtable;
	$args = func_get_args();
	$results = '';
	foreach ($args as $key => $value) {
		if ($key == 0) {
			$results = $results.'<API>'.$value.'</API>';
		} else {
				$results = $results.'<PARM'.$key.'>'.$value.'</PARM'.$key.'>';
		}
	}
	return $results;
}

$fetch['test1'] = 'thisisok';
$fetch['test2'] = 'ffffffff';

echo binlogdata('PlayerLimit',$fetch['test1'],$fetch['test2']);



Expected result:
----------------
// The expected result is 	"<API>PlayerLimit</API><PARM1>thisisok</PARM1><PARM2>ffffffff</PARM2>";


Actual result:
--------------
// The actual result is 	"<API>PlayerLimit</API><PARM1>thisisok</PARM1><PARM2></PARM2>";


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-12-09 22:15 UTC] alan_k@php.net
I cant reproduce this on php5 or php4.3.2-RC

Does this exhibit the same problem?
php -r 'function test() { print_r(func_get_args()); } test("ffffffff","ffffffff");'


 [2003-12-09 22:35 UTC] Mentaloid at hotmail dot com
I'm unable to reproduce using your code.. (the -r is unavailable on my command line, so I droped it into a .php file and ran it that way). 

However, I'm also unable to reproduce it via a static 'ffffffff' string, however it will not work with a string from a sql result. strlen($fetch['test1']) shows 8 bytes, so I don't believe there is a leading or trailing null. I will do some more investigating here, and update with any more results I can dig up. The function I posted is as is, but I'll see if I can setup a source that will reproduce this for you. It could be a lot more source to sift through ;)
 [2003-12-09 23:23 UTC] Mentaloid at hotmail dot com
Hmm - I'm so embarrassed - this has problem has been buggin me for days, I go and make a bug report and I can't reproduce it with my original code that would for the life of me not work as expected. Now it does. This is an exact copy - database included (binary innodb copy). 

http://tko.mentadd.com/test/index.php

Sorry to bother you guys, I know your all real busy.
 [2003-12-09 23:47 UTC] alan_k@php.net
If you ever find out why - reopen it :)

Regards
Alan
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Tue Dec 09 14:00:01 2025 UTC