Forum

Welcome to ProjeQtOr new Forum. We migrated old forum to the new website.
You will find all your posts here, with your usual account.
Just one point : you’ll have to reinitialize your password. Use “Lost password” feature.

Undefined variable ...
 
Notifications
Clear all

Undefined variable in "importable.php"

3 Posts
2 Users
0 Reactions
4,470 Views
 Dan
(@caccia)
Posts: 340
Contributor
Topic starter
 
[#1411]

Hi again,

I encountered an "undefined variable" error while attempting to import a CSV file.
In file importable.php, the variable $line is initialized within an if() clause (around line 225):

if (count($fields) > count($title)) {
   $line="";
   foreach($fields as $field){
      $line.=$field." ;; ";
   ...

Below this, $line is used outside of this if() clause (l.243):

          $htmlResult.= $line;
          $htmlResult.= '';

I guess $line should be at least initialized outside of the if().

Note: encountered this when using one CSV file to import Actions, where:
- first few lines were updating status of existing actions
- then some lines to create new actions (ID field empty)


 
Posted : 14 Oct 2013 17H17
(@babynus)
Posts: 14952
Member Admin
 

Hi,

Ticket #1202 recorded to fix this issue.

For information :
- the proposed fix is not complete, not only $line must be initizalized, but also completed (including the foreach loop)
- you face this issue because your import file contains no numeric data for id. I guess you entered some spaces for blank ids, and this led to the issue. I then also added fix to remove spaced from id...

Thanks for reporting.
Babynus


 
Posted : 16 Oct 2013 14H53
 Dan
(@caccia)
Posts: 340
Contributor
Topic starter
 

Thanks for the information - on the file and on the fix ! 🙂
I knew it was caused by a problem on the file, but wasn't sure what exactly...


 
Posted : 16 Oct 2013 18H53
Share:

Scroll to Top