1
timgno
Control structures elseif.php
  • 2014/6/18 14:15

  • timgno

  • Module Developer

  • Posts: 1504

  • Since: 2007/6/21


Look like this:
http://www.php.net/manual/it/control-structures.elseif.php

In many file there are else if

Nothing happens?

2
Mamba
Re: Control structures elseif.php
  • 2014/6/18 15:14

  • Mamba

  • Moderator

  • Posts: 11409

  • Since: 2004/4/23


Quote:
Nothing happens?

That's too generic statement

Can you give us concrete examples what doesn't happen, and where exactly?

How can we replicate it?
Support XOOPS => DONATE
Use 2.5.11 | Docs | Modules | Bugs

3
timgno
Re: Control structures elseif.php
  • 2014/6/18 15:33

  • timgno

  • Module Developer

  • Posts: 1504

  • Since: 2007/6/21


Quote:
Mamba wrote:
How can we replicate it?


It could be just me!

But in the class/model/write.php in updateAll function exists just what the manual says, no php error than to edit for fileds in TDMCreate 1.91 module.

I always get the error for the get() function:
Quote:
Fatal error: Call to a member function setVar() on a non-object in C:\wamp\www\xoops-2.5.7testTDMCreate1.91\htdocs\modules\TDMCreate\admin\fields.php on line 176


If solved the problem of the object when I do update data, they are overwritten all fields with the last one.

I know it might be a different problem, but I would understand.

If it were so will need to open a separate thread for the module tdmcreate.

I need help!

I hope that my report to the class/model/write.php is appropriate, surely there are other files with this code

Thank you very much!

4
Mamba
Re: Control structures elseif.php
  • 2014/6/18 16:02

  • Mamba

  • Moderator

  • Posts: 11409

  • Since: 2004/4/23


I have moved and renamed this topic, because it is not directly related to XOOPS 2.5.7.

If you would show that it worked in XOOPS 2.5.6, and now it doesn't work anymore in XOOPS 2.5.7, then it would belong there.

However, you're not sure if this is a bug in TDMCreate, or if this is bug in XOOPS Core.

To make sure that this is a bug, please change the "else if" structure of the Core file, and test it that it fixes your issue.

From the debugging perspective you have to ask yourself: why is the object that you are trying to call setVar on, not present? Did you create the instance of it properly?

Also, please provide exact steps when this error happens, otherwise how could we try to replicate it?
Support XOOPS => DONATE
Use 2.5.11 | Docs | Modules | Bugs

5
geekwright
Re: Control structures elseif.php

Looking in SVN to get the context I am suspicious of line 171 in \modules\TDMCreate\admin\fields.php:

switch($value){
        case 
'new':
            
$fieldsObj =& $fields->create();                    
        break;
        case 
'edit':
            
$fieldsObj =& $fields->get($value);
        break;                    
    }


The 'edit' case is always $fieldsObj =& $fields->get('edit');

Hope that helps.

6
timgno
Re: Control structures elseif.php
  • 2014/6/18 18:46

  • timgno

  • Module Developer

  • Posts: 1504

  • Since: 2007/6/21


Quote:

geekwright wrote:
Looking in SVN to get the context I am suspicious of line 171 in \modules\TDMCreate\admin\fields.php:

switch($value){
        case 
'new':
            
$fieldsObj =& $fields->create();                    
        break;
        case 
'edit':
            
$fieldsObj =& $fields->get($value);
        break;                    
    }


The 'edit' case is always $fieldsObj =& $fields->get('edit');

Hope that helps.


Thank you Richard!

I had already figured this out, unfortunately I have to keep it that way for now if I want to create again.

I tried to insert that works send this update, but overwrites all fields in the same table with the last:

switch($value){
    case 
'new':
        
$fieldsObj =& $fields->create();                    
    break;
    case 
'edit':
        
$fieldsObj =& $fields->get($field_tid);                                    
    break;                    
}


Example:
field_id
field_name
field_desc

It write them all three fields with field_desc data

I know that I need to retrieve all of the fields based on the id table, and this is done but it is not saved regularly.

I tried to put in place of 'edit' in the class file -> getVar ('field_id') but I have not solved.

At this point I do not know if I should create a special function with native php functions or if there is no other solution.

Any suggestions?

Thanks again

Louis

7
Mamba
Re: Control structures elseif.php
  • 2014/6/18 19:22

  • Mamba

  • Moderator

  • Posts: 11409

  • Since: 2004/4/23


Quote:
At this point I do not know if I should create a special function with native php functions or if there is no other solution.

I don't have the answer for it without looking at your code, but one thing is for sure:

We can NOT blame everything on the XOOPS Core!!

As I've mentioned before, debugging is a systematic process, where you have set your assumptions, and then test them step by step. If an object is not present as it should, you have to go step by step, set up breaks in the code, and then check if the object is being instantiated where it should be.

And let's be realistic: in 95-98% of cases it is our mistake, not a bug in the Core

This, of course, is not to say that there are no bugs in the Core! It might happen for example, that a code that worked on PHP 4, is becoming a bug under PHP 5.5.x.

But we need to do our homework first, i.e. test the module code we're writing, and once we're absolutely sure that our logic is correct, as proved by tests, then look at the Core and then test it at the Core level before we jump to any conclusions and blame it on the Core!
Support XOOPS => DONATE
Use 2.5.11 | Docs | Modules | Bugs

8
timgno
Re: Control structures elseif.php
  • 2014/6/19 8:58

  • timgno

  • Module Developer

  • Posts: 1504

  • Since: 2007/6/21


Quote:

Mamba wrote:...
We can NOT blame everything on the XOOPS Core!!
...
And let's be realistic: in 95-98% of cases it is our mistake, not a bug in the Core
...


Mine is not a fault to the core, but a request for help, since I did some testing with the tools at my disposal as sahi and selenium ide.

From these tests have not found a good help.

For this reason, I ask again for help to see if there are other more effective tools that can solve this little problem.

Do not be altered ...! I know the work that is behind the core, and it is not my intention to throw the assessments so haphazardly

9
timgno
Re: Control structures elseif.php
  • 2014/6/19 10:29

  • timgno

  • Module Developer

  • Posts: 1504

  • Since: 2007/6/21


Now I can update the data by replacing
field_tid:
class TDMCreateFieldsHandler extends XoopsPersistableObjectHandler 
{    
    
/*
    *  @public function constructor class
    *  @param mixed $db
    */
    
public function __construct(&$db
    {        
        
parent::__construct($db'mod_tdmcreate_fields''tdmcreatefields''field_tid''field_name');
    }

with

field_id:
class TDMCreateFieldsHandler extends XoopsPersistableObjectHandler 
{    
    
/*
    *  @public function constructor class
    *  @param mixed $db
    */
    
public function __construct(&$db
    {        
        
parent::__construct($db'mod_tdmcreate_fields''tdmcreatefields''field_id''field_name');
    }


for keyName but I can not edit selected according to the table because I want to edit any table, the first table shows the form, always

Login

Who's Online

435 user(s) are online (307 user(s) are browsing Support Forums)


Members: 0


Guests: 435


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Nov 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits