Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ObjectObject - Object of class User to string conversion #58

Closed
GoogleCodeExporter opened this issue Jul 29, 2015 · 9 comments
Closed

Comments

@GoogleCodeExporter
Copy link

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
Copy link
Author

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
Copy link
Author

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
Copy link
Author

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
Copy link
Author

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

@GoogleCodeExporter
Copy link
Author

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

  • Added labels: Milestone-v2.0.1

@GoogleCodeExporter
Copy link
Author

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

  • Changed state: Accepted

@GoogleCodeExporter
Copy link
Author

Including these changes in 2.01

Thanks Mats

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

@GoogleCodeExporter
Copy link
Author

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

  • Changed state: Started

@GoogleCodeExporter
Copy link
Author

This issue was closed by revision r891.

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

  • Changed state: Fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant