Export data hardware empty

Bug #1581207 reported by Lucas Brescia on 2016-05-12
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
OCS Inventory: OCSReports
Undecided
Unassigned

Bug Description

When a try to export data in link donwload the system export empty informotions, i look in log o apache and the same said this error:

Version ocs inventory: 2.2 Linux , Debian.

[Thu May 12 16:27:55.349295 2016] [:error] [pid 41987] [client 192.168.99.139:49280] PHP Warning: mysqli_fetch_array() expects parameter 2 to be integer, string given in /usr/share/ocsinventory-reports/ocsreports/plugins/main_sections/ms_export/ms_csv.php on line 114

Lucas Brescia (lbrescia) on 2016-05-12
description: updated
Ron (ronator) wrote :

I have the same bug but I noticed sth. else.

Inventory -> All softwares, then I filter on one application and I click on the value in the row "Count" (to see all hosts with that software). This opens up an overview, where I can download the list of all hosts with this software. If I try to download it, the same error as above appears in logs and the table is empty (only row header names).

Furthermore, in the row "computer" there appears the software name of the software I was filtering on. I guess, 'fetch_row' is wrongly assigning some rows. This problem occured since we use ocs 2.2 (clean install, no sql import, no change on clients).

Lucas, could you confirm having the _software name_ in the row "Computer" on that export page? If yes, this is another effect of the problem and might explain the error (because it's simply using the wrong rows/values from the table and expects other variable types and so does fail).

Best
Ron

Ron (ronator) wrote :

They say it is fixed, but I am still investigating the issue -> https://github.com/OCSInventory-NG/OCSInventory-ocsreports/issues/40

Ron (ronator) wrote :

check out https://github.com/OCSInventory-NG/OCSInventory-ocsreports/commit/ebc802bc0b0cfb035fab31479a52aa24bc7a240f - this will fix the computer/software name issue.

The second problem with export seems to be an php7.0 issue.

Ron (ronator) wrote :

1) Either change MYSQL_ASSOC to MYSQLI_ASSOC or remove it - it is an optional parameter.

Line 114 of ms_cvs.php, changed this

while( $cont = mysqli_fetch_array($result,MYSQL_ASSOC) ) {

to that: while( $cont = mysqli_fetch_array($result) ) {

After this, export works, but still error on line 86 in this file.

Change this:

while( $cont = mysqli_fetch_array($result,MYSQL_ASSOC) ) {

to that:

while( $cont = mysqli_fetch_array($result) ) {

Now, export should work and error should vanish from apache2 error.log

Please also note that according to the developers, ocsinventory is not supposed to support php7.0 - it has improved php 5.5 support so be ready to run into errors with php 7 ...

Ron,

I just change MYSQL_ASSOC to MYSQLI_ASSOC and working great, tks so much
for your help...

2016-06-03 12:10 GMT-03:00 Ron <email address hidden>:

> 1) Either change MYSQL_ASSOC to MYSQLI_ASSOC or remove it - it is an
> optional parameter.
>
> Line 114 of ms_cvs.php, changed this
>
> while( $cont = mysqli_fetch_array($result,MYSQL_ASSOC) ) {
>
> to that: while( $cont = mysqli_fetch_array($result) ) {
>
> After this, export works, but still error on line 86 in this file.
>
> Change this:
>
> while( $cont = mysqli_fetch_array($result,MYSQL_ASSOC) ) {
>
> to that:
>
> while( $cont = mysqli_fetch_array($result) ) {
>
> Now, export should work and error should vanish from apache2 error.log
>
> Please also note that according to the developers, ocsinventory is not
> supposed to support php7.0 - it has improved php 5.5 support so be
> ready to run into errors with php 7 ...
>
> --
> You received this bug notification because you are subscribed to the bug
> report.
> https://bugs.launchpad.net/bugs/1581207
>
> Title:
> Export data hardware empty
>
> Status in OCS Inventory: OCSReports:
> New
>
> Bug description:
> When a try to export data in link donwload the system export empty
> informotions, i look in log o apache and the same said this error:
>
> Version ocs inventory: 2.2 Linux , Debian.
>
> [Thu May 12 16:27:55.349295 2016] [:error] [pid 41987] [client
> 192.168.99.139:49280] PHP Warning: mysqli_fetch_array() expects
> parameter 2 to be integer, string given in /usr/share/ocsinventory-
> reports/ocsreports/plugins/main_sections/ms_export/ms_csv.php on line
> 114
>
> To manage notifications about this bug go to:
>
> https://bugs.launchpad.net/ocsinventory-ocsreports/+bug/1581207/+subscriptions
>

--
           Lucas Brescia de Moura

Philippe BEAUMONT (kapouik) wrote :

The project OCS Inventory NG is now on Github => https://github.com/OCSInventory-NG

Launchpad is not used anymore

Changed in ocsinventory-ocsreports:
status: New → Invalid
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers