1
cpascal
catads 1.53.5 RC3 -Uninitialized string
  • 2010/10/9 13:32

  • cpascal

  • Just popping in

  • Posts: 26

  • Since: 2010/3/20


hi

I have an error in .../modules/catads/adslist.php
error message:
Uninitialized string offset: 0 in file ... /modules/catads/adslist.php

corresponds to:
$topic_id $topic_title['topic_id'];//bug



2
Peekay
Re: catads 1.53.5 RC3 -Uninitialized string
  • 2010/10/9 14:07

  • Peekay

  • XOOPS is my life!

  • Posts: 2335

  • Since: 2004/11/20


Thx. I had seen the notice, but I am not sure of a solution.

AFAIK it doesn't affect the operation of the module, but I will have another look at the code.
A thread is for life. Not just for Christmas.

3
Tarik
Re: catads 1.53.5 RC3 -Uninitialized string
  • 2010/10/9 14:13

  • Tarik

  • Not too shy to talk

  • Posts: 170

  • Since: 2010/2/3 1


$topic_id $topic_title['topic_id'];//bug

the problem with this code is that $topic_title has value null
and $topic_title['something'] gives error
so try
$topic_id = isset($topic_title['topic_id']?$topic_title['topic_id']:0;//:)


example

4
Peekay
Re: catads 1.53.5 RC3 -Uninitialized string
  • 2010/10/9 14:24

  • Peekay

  • XOOPS is my life!

  • Posts: 2335

  • Since: 2004/11/20


Many thx Tarik. I'll patch that file.

I use a similar code to address undefined variables, but it uses 'null' as the default, not a numeric value. That probably explains why it fails to cure undefined offsets!
A thread is for life. Not just for Christmas.

5
cpascal
Re: catads 1.53.5 RC3 -Uninitialized string
  • 2010/10/9 14:32

  • cpascal

  • Just popping in

  • Posts: 26

  • Since: 2010/3/20


Hi Tarik and Peekay

thank you for your help I put it:

//$topic_id = $topic_title['topic_id'];//bug
$topic_id = isset($topic_title['topic_id']) ? $topic_title['topic_id'] : ;


more error message everything seems to work but obviously this is not the answer

6
Tarik
Re: catads 1.53.5 RC3 -Uninitialized string
  • 2010/10/9 14:39

  • Tarik

  • Not too shy to talk

  • Posts: 170

  • Since: 2010/2/3 1


my mistake we have to check if the parent isset
//$topic_id = $topic_title['topic_id'];//bug
$topic_id = isset($topic_title) ? $topic_title['topic_id'] : ;

if it doesn't work try give me a notice

7
cpascal
Re: catads 1.53.5 RC3 -Uninitialized string
  • 2010/10/9 14:59

  • cpascal

  • Just popping in

  • Posts: 26

  • Since: 2010/3/20


$topic_id $topic_title['topic_id'];//bug

= Uninitialized string offset: 0 in file /modules/catads/adslist.php

and

$topic_id = isset($topic_title) ? $topic_title['topic_id'] : ;//bug

= Uninitialized string offset: 0 in file /modules/catads/adslist.php


and

$topic_id = isset($topic_title['topic_id']) ? $topic_title['topic_id'] : ;

= good more message bug everything seems to work


a bit earlier I had another message
A session had already been started - ignoring session_start() in file ../modules/catads/adslist.php

Attention! I am not a php coder, but I'm trying to learn
so I replace
//session_start();
if (!session_id()) session_start();


more error message everything seems to work for now

thank you




8
Tarik
Re: catads 1.53.5 RC3 -Uninitialized string
  • 2010/10/9 15:48

  • Tarik

  • Not too shy to talk

  • Posts: 170

  • Since: 2010/2/3 1


can you upload the file so to find more about the declaration of the variable
Some people like what you do,
-- some people hate what you do,
---- but most people simply don’t give a damn.

9
Peekay
Re: catads 1.53.5 RC3 -Uninitialized string
  • 2010/10/9 16:56

  • Peekay

  • XOOPS is my life!

  • Posts: 2335

  • Since: 2004/11/20


@ cpascal

I used a session variable to get pagination to work when you get a lot of results from a search query. It looks like PHP is ignoring the command, but you are right that checking for a session-start is a better idea.

As long as search pagination works, I'll use your recommended code for the final version.

A thread is for life. Not just for Christmas.

10
cpascal
Re: catads 1.53.5 RC3 -Uninitialized string
  • 2010/10/9 17:27

  • cpascal

  • Just popping in

  • Posts: 26

  • Since: 2010/3/20


ok thank

I have just one last question in the preferences of Catads there is an option: Anonymous may post: yes or no -> config anoncanpost

which corresponds to:
in file ../catads/submit.php

if (!$xoopsModuleConfig['anoncanpost'] && !$xoopsUser){
        
redirect_header(XOOPS_URL."/user.php",3,_MD_CATADS_ONLY_MEMBERS);
        exit();
}



it seems that this option is useless and is not taken into account as allowed for anonymous file has ads must go to the permissions of the module therefore has what is this option?

otherwise everything else seems to work properly

Login

Who's Online

425 user(s) are online (332 user(s) are browsing Support Forums)


Members: 0


Guests: 425


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