bwssytems / domuslink

web-based frontend for Heyu
http://domus.link.co.pt/
1 stars 1 forks source link

ObjectObject - Object of class User to string conversion #58

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
When I make a clean installation and then access the application the httpd 
error log says:
PHP Notice:  Object of class User to string conversion in
/var/www/virtual/myserver/domus/lib/func/file.func.php on line 63, referer: 
http://myserver/domus/login.php?from=index&failed=true

The db/userdb file then has the content ObjectObject

When refreshing the site the error log complains about 'line 1, User element 
has wrong number of entries'

My PHP is 5.1.6

I have read about object string conversion problems and different PHP versions.

Any help?
/Mats

Original issue reported on code.google.com by tillm...@gmail.com on 4 May 2011 at 9:05

GoogleCodeExporter commented 9 years ago
Reading issue 47 more carefully I now think this issue is the same as that. I 
think it is a PHP 5.1.6 issue
Forgot to say that DL is 2.0
/Mats

Original comment by tillm...@gmail.com on 4 May 2011 at 9:10

GoogleCodeExporter commented 9 years ago
I fixed this myself by adding code in file 'file.func.php'
I added '->__tostring()' in the fwrite function

function save_file($content, $fileloc) {
        global $lang;
        if(file_exists($fileloc)) {
                if (!is_writable($fileloc))
                        throw new Exception($fileloc." ".$lang['error_filerw']);
        }

        $fp = fopen($fileloc,'w');
        if(!$fp) {
                throw new Exception($fileloc." ".$lang['error_filerw']);
        }

        foreach ($content as $line) {
                $write = fwrite($fp, $line->__tostring());
        }
        fclose($fp);
}

Chers

Original comment by tillm...@gmail.com on 5 May 2011 at 3:23

GoogleCodeExporter commented 9 years ago
That is an interesting issue as PHP should call the __toString method 
automatically. A s all objects within domus.link inherit from Element.class.php 
which has the __toString function defined and which you show you are forcing in 
the code change.

Will see about including that change after some more testing, but if it solves 
the issue in different installs, most likely a good idea.

Thanks for the review and work on this.

Original comment by bwsamuels@gmail.com on 16 May 2011 at 3:53

GoogleCodeExporter commented 9 years ago

Original comment by bwsamuels@gmail.com on 16 May 2011 at 4:01

GoogleCodeExporter commented 9 years ago

Original comment by bwsamuels@gmail.com on 17 May 2011 at 1:44

GoogleCodeExporter commented 9 years ago

Original comment by bwsamuels@gmail.com on 17 May 2011 at 1:45

GoogleCodeExporter commented 9 years ago
Including these changes in 2.01

Thanks Mats

Original comment by bwsamuels@gmail.com on 15 Jun 2011 at 2:10

GoogleCodeExporter commented 9 years ago

Original comment by bwsamuels@gmail.com on 2 Dec 2011 at 3:09

GoogleCodeExporter commented 9 years ago
This issue was closed by revision r891.

Original comment by bwsamuels@gmail.com on 4 Dec 2011 at 6:57