php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #10913 hw_who() returns incorrect data & prints extraneous string (patch incl.)
Submitted: 2001-05-16 21:31 UTC Modified: 2007-04-04 20:09 UTC
From: torben@php.net Assigned:
Status: Not a bug Package: Unknown/Other Function
PHP Version: 4.0 Latest CVS (2001-05-16) OS: Linux 2.2.14/Mandrake 7
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 this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: torben@php.net
New email:
PHP Version: OS:

 

 [2001-05-16 21:31 UTC] torben@php.net
Just found this with hw_who(): the returned array skipped some attributes and printed what looked like
a debugging string when called. Basic upshot was that the array returned didn't have all of the actual
data returned from the Hyperwave server, and all values were associated with the wrong keys (except
for 'self').

This patch seems to fix it for me:

Index: hw.c
===================================================================
RCS file: /repository/php4/ext/hyperwave/hw.c,v
retrieving revision 1.81
diff -u -r1.81 hw.c
--- hw.c	2001/04/30 12:53:55	1.81
+++ hw.c	2001/05/17 01:20:09
@@ -1190,7 +1190,10 @@
 
 	ptr = object;
 
+#if 0
 php_printf("%s\n", ptr);
+#endif
+
 	/* Skip first two lines, they just contain:
         Users in Database
 
@@ -1228,6 +1231,9 @@
 			add_assoc_long(user_arr, "self", 0);
 			
 		ptr++;
+		while((*ptr != '\0') && (*ptr == ' '))
+			ptr++;
+
 		name = ptr;
 		while((*ptr != '\0') && (*ptr != ' '))
 			ptr++;
@@ -1235,6 +1241,9 @@
 		add_assoc_string(user_arr, "id", name, 1);
 
 		ptr++;
+		while((*ptr != '\0') && (*ptr == ' '))
+			ptr++;
+
 		name = ptr;
 		while((*ptr != '\0') && (*ptr != ' '))
 			ptr++;

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-05-16 22:09 UTC] torben@php.net
Just a minor change to the patch: s/#if 0/#ifdef HW_DEBUG/. :)
 [2002-05-25 09:07 UTC] derick@php.net
Thank you for taking the time to report a problem with PHP.
Unfortunately your version of PHP is too old -- the problem
might already be fixed. Please download a new PHP
version from http://www.php.net/downloads.php

If you are able to reproduce the bug with one of the latest
versions of PHP, please change the PHP version on this bug report
to the version you tested and change the status back to "Open".
Again, thank you for your continued support of PHP.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Mar 29 06:01:29 2024 UTC