fatal error cannot redeclare

91 views
Skip to first unread message

Ronald Jones

unread,
Jul 30, 2023, 11:49:51 PM7/30/23
to Open Source CAD
under the config tab for reset unit status i get this error. does anyone else get this type of error? 


Fatal error: Cannot redeclare get_status_name() (previously declared in C:\xampp\htdocs\tickets\tickets-3.40.3\reset_responder_status.php:12) in C:\xampp\htdocs\tickets\tickets-3.40.3\incs\member.inc.php on line 56

Arnie Shore

unread,
Jul 31, 2023, 9:37:57 AM7/31/23
to open-so...@googlegroups.com
Yes, confirmed.  Hmmmmmmm ... .

AS

On Sun, Jul 30, 2023 at 11:49 PM Ronald Jones <mike20...@gmail.com> wrote:
under the config tab for reset unit status i get this error. does anyone else get this type of error? 


Fatal error: Cannot redeclare get_status_name() (previously declared in C:\xampp\htdocs\tickets\tickets-3.40.3\reset_responder_status.php:12) in C:\xampp\htdocs\tickets\tickets-3.40.3\incs\member.inc.php on line 56

--
You received this message because you are subscribed to the Google Groups "Open Source CAD" group.
To unsubscribe from this group and stop receiving emails from it, send an email to open-source-c...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/open-source-cad/0c681abc-2e16-4bfa-81ec-fe91486fa0ecn%40googlegroups.com.

Eric Osterberg

unread,
Jul 31, 2023, 11:26:47 AM7/31/23
to open-so...@googlegroups.com
So looks like we have the same function name used twice.
READ BELOW FOR THE QUICK FIX!

In reset_responder_status.php
function get_status_name($val) {
$query = "SELECT * FROM `$GLOBALS[mysql_prefix]un_status` WHERE `id` = " . $val;
$result = mysql_query($query);
if(mysql_num_rows($result) > 0) {
$row = stripslashes_deep(mysql_fetch_assoc($result));
$the_name = $row['group'] . " - " . $row['status_val'];
} else {
$the_name = "";
}
return $the_name;
}

And in member.inc.php
function get_status_name($id) {
$query = "SELECT * FROM `$GLOBALS[mysql_prefix]member_status` WHERE `id` = " . $id;
$result = mysql_query($query) or do_error($query, 'mysql query failed', mysql_error(), basename( __FILE__), __LINE__);
$row = mysql_fetch_array($result);
return $row['status_val'];
}

And finally, I found in functions.inc.php
function get_un_status_name($id) {
$query = "SELECT * FROM `$GLOBALS[mysql_prefix]un_status` WHERE `id` = " . $id;
$result = mysql_query($query);
if($result && mysql_num_rows($result) > 0) {
$row = stripslashes_deep(mysql_fetch_assoc($result));
return $row['status_val'];
} else {
return "unk";
}
}

The function in tickets/reset_responder_status.php can be renamed (Or removed).

On approximate line 12, rename the function...
function get_broken_status_name($val) {

Or simply remove the function.

Updates will be available on GitHub in about 10 minutes.

Thank you for reporting the defect.

 - Eric Osterberg


Ronald Jones

unread,
Aug 1, 2023, 11:27:32 PM8/1/23
to Open Source CAD
renamed function to the listed change and tried to use the reset responder status and got the followingScreenshot 2023-08-01 232550.png

Eric Osterberg

unread,
Aug 2, 2023, 10:01:00 AM8/2/23
to open-so...@googlegroups.com
I have not been able to reproduce that error. What status did you attempt to select?
image.png
Can you confirm seeing the drop down?

Can you send me the file C:\xampp\htdocs\tickets\tickets-3.40.3\incs\member.inc.php?

Eric Osterberg

unread,
Aug 2, 2023, 10:30:25 AM8/2/23
to open-so...@googlegroups.com
Ronald,
I'm also curious if you have any issues when clicking on the units tab? Do you see statuses for all units?
Have you made any updates via MySQL directly?

image.png

Ronald Jones

unread,
Aug 2, 2023, 11:27:04 PM8/2/23
to Open Source CAD
i can see all units, no updates made directly to mysql, yes i can see the drop down.Screenshot 2023-08-02 232029.png
Screenshot 2023-08-02 232309.png
I've went ahead and deleted the statuses then made new ones. and rechecked the function and got another error along with the original one.
Screenshot 2023-08-02 232352.png

Ronald Jones

unread,
Aug 2, 2023, 11:29:37 PM8/2/23
to Open Source CAD
attached is the member.php
member.inc.php

Ronald Jones

unread,
Aug 2, 2023, 11:32:47 PM8/2/23
to Open Source CAD
system info 

PHP Version:

7.4.4 under Apache/2.4.43 (Win64) OpenSSL/1.1.1g PHP/7.4.4

Database:

cad on localhost running mysql 5.5.5-10.4.11-MariaDB


Eric Osterberg - NØNKI

unread,
Sep 11, 2023, 11:15:50 PM9/11/23
to Open Source CAD
Were you able to resolve the issue?
I was not able to reproduce the problem.
Are you able to update to the latest version?
Reply all
Reply to author
Forward
0 new messages