Reported by Roch Delsalle, Dec 21, 2009
Hi, I have installed Indefero on my dev server, but it's crashing when I try to open the source page. PlufErrorHandlerException making GET request to /index.php/p/project/source/tree/HEAD/ 8 : Trying to get property of non-object It might be something to do with the xml parsing. This is the last stacktrace: Svn.php l405 $res['author'] = (string) $xml->logentry->author; -------------------------------------------------- Arg Name Value 0 $code 8 1 $string Trying to get property of non-object 2 $file /home/.sites/28/site1/web/code/indefero/src/IDF/Scm/Svn.php 3 $line 405 4 ? Array ( [commit] => HEAD [getdiff] => [res] => Array ( ) [cmd] => svn log --xml --limit 1 -v --username='username' --password='password' 'http://ip/svn/project/'@'HEAD' [xmlRes] => [xml] => )
Comment 1 by Roch Delsalle, Dec 21, 2009
I also got the same problem on the timeline module.
Comment 2 by Loïc d'Anterroches, Jan 15, 2010
If your subversion repository is on your local server, you need to put file:///path/to/repository See http://svnbook.red-bean.com/en/1.1/ch07s07.html If you type this command: svn log --xml --limit 1 -v --username='username' \ --password='password' 'http://ip/svn/project/'@'HEAD' in your shell, what do you get?
Comment 3 by Roch Delsalle, Jan 15, 2010
When I type the command it works. It's not possible to add the repository url as file:// when we create a project in indefero, so I have modified it directly into the mysql tables. Unfortunately I still get an error: 8 : Trying to get property of non-object
Comment 4 by Loïc d'Anterroches, Jan 15, 2010
Ok, now I understand. When you setup a repository from within InDefero for subversion, by default it is a local repository and everything is taken care of. Can you create a new subversion repository with the minimal set of details to have it as local and test it?
Comment 5 by Nikolaus Schaller, Jan 22, 2010
Stacktrace ▼ PlufErrorHandler [No File, line 0] ▼ Args Arg Name Value 0 $code 2 1 $string simplexml_load_string() [<a href='function.simplexml-load-string'>function.simplexml-load-stri ng</a>]: Entity: line 3: parser error : Premature end of data in tag log line 2 2 $file /Library/WebServer/Documents/mirror/projects.goldelico.com/indefero/s rc/IDF/Scm/Svn.php 3 $line 243 4 ? Array ( [rev] => 24805 [cmd] => svn log --xml --limit 1 --username='' --password='' ' svn://svn.gna.org/svn/gnustep/libs/simplewebkit/trunk'@'24805' ) No src available simplexml_load_string [/Library/WebServer/Documents/mirror/projects.goldelico.com/indefero/ src/IDF/Scm/Svn.php, line 243] ▼ Args Arg Name Value 0 ? <?xml version="1.0"?> <log> ▼ Src escapeshellarg($this->username), escapeshellarg($this->password), escapeshellarg($this->repo), escapeshellarg($rev)); $cmd = Pluf::f('idf_exec_cmd_prefix', '').$cmd; $xml = simplexml_load_string(shell_exec($cmd)); $this->cache['commitmess'][$rev] = (string) $xml->logentry->msg; return $this->cache['commitmess'][$rev]; } public function getPathInfo($filename, $rev=null) IDF_Scm_Svn->getCommitMessage [/Library/WebServer/Documents/mirror/projects.goldelico.com/indefero/ src/IDF/Scm/Svn.php, line 213] ▼ Args Arg Name Value 0 $rev 24805 ▶ Src When I try to execute the svn command directly in a shell, I get an error message from SVN: $ svn log --xml --limit 1 --username='' --password='' ' svn://svn.gna.org/svn/gnustep/libs/simplewebkit'@'24805' <?xml version="1.0"?> <log> svn: File not found: revision 24805, path '/libs/simplewebkit' $ I don't know why I get this error but nevertheless, Indefero is not prepared for handling it.
Comment 6 by Loïc d'Anterroches, Jan 25, 2010
You are accessing a remote repository using the custom svn server, not a local repository. Local repository have file:/// URLs. http://svnbook.red-bean.com/nightly/en/svn-book.html#svn.basic.in-act ion.wc.tbl-1 This is normal to have it throwing an error on you as it is a configuration error. Please test with a local repository.
Comment 7 by Nikolaus Schaller, Jan 25, 2010
But I simply want to access a *remote repository* and get the error message which I have traced down to the failing svn log command.
Comment 8 by Brian Armstrong, Feb 11, 2010
$ svn log --xml --limit 1 --username='' --password='' ' svn://svn.gna.org/svn/gnustep/libs/simplewebkit'@'24805' <?xml version="1.0"?> <log> svn: File not found: revision 24805, path '/libs/simplewebkit' The crash is being caused by a SimpleXML error being generated because of what I consider a bug in SVN. If you run the command above without the '--xml' option it will simply print out "svn: File not found: ...". For some reason, SVN cannot handle this properly and so it does the following. Starts to generate the XML for the log entry, prints the error message when it can't find the file, then exits. Thus, you have invalid XML generated when the file is not found. This functionality, I would qualify as a bug in SVN. We have run into this same problem. And to make it so indefero does not crash is actually quite easy. When SimpleXML finds bad XML it generates WARNINGS, not errors. When php tries to get a property on a non-object it generates NOTICES. All you have to do to get this to not crash indefero is to change your php error reporting to not include Warnings or Notices. Otherwise, they are caught by the indefero error handler and these non-fatal errors become fatal. Sample PHP error reporting value: E_ALL & ^E_WARNING & ^E_NOTICE There should be some sanity checking inside the source code to check for this kind of thing happening, but since there is not (yet), change the error reporting level and it will "fix" it.
Comment 9 by Brian Armstrong, Feb 11, 2010
The attached patch will prevent your indefero from crashing when svn can't find the revision you are looking for. It won't make it display information it cannot find, but it will prevent the crash without server reconfiguration.
Comment 10 by Loïc d'Anterroches, Feb 14, 2010
Changed as patch to review.
Comment 11 by Tomasz Jędrzejewski, Feb 25, 2010
I think the problem may lie in the Indefero configuration, some other mysterius interferences between the web server and Indefero which fail during the SVN output parsing: I have a remote repository via HTTPS and an Indefero installation. When configured on that installation, Indefero crashed attempting to parse the output. Then I set up a local version of Indefero for testing, putted the same repository URL and the same auth data and it worked. I also checked the output of the "svn log" command. SVN first returns the following output: <?xml version="1.0"?> <log> and shortly after it, the rest of the output comes. It seems that shell commands used by Indefero return those two lines only, ignoring the further content.
Comment 12 by Loïc d'Anterroches, Feb 25, 2010
What do you get when you run the command from the shell on your server? What is the difference (OS, PHP version, subversion version) between your dev box and your server?
Comment 13 by Phil Hord, Mar 1, 2010
I am getting the same error as Tomasz, now. It seems like the problem is one of timing. When I run the "svn log" command manually, it works, but as Tomasz says, it stalls briefly (about 0.8 seconds) after the "<log>" line, and then it prints 205 more lines of XML. It seems like Pluf or Indefero is giving up at this point and trying to parse the incomplete XML.
Comment 14 by Phil Hord, Mar 1, 2010
Retraction. It does not appear to be an error of timing. I added a "sleep 5" before my SVN command. Indefero pauses 5 seconds to wait for the app to finish, but it appears to collect only the first two output lines for some reason. I also tried appending "|cat" to coalesce the output somehow, and also "2>&1", but nothing has worked. I tried the shell_exec command from my own test.php (on the cli) using the same command it worked perfectly. I even tried stripping all LF's (still valid XML), but no dice: 0 $code 2 1 $string simplexml_load_string() [function.simplexml-load-string]: Entity: line 2: parser error : Premature end of data in tag log line 1 2 $file /home/www/indefero/src/IDF/Scm/Svn.php 3 $line 407 4 ? Array ( [commit] => HEAD [getdiff] => [res] => Array ( ) [cmd] => svn log --xml --limit 1 -v --username='user' --password='password' 'https://126.96.36.199/myproj/trunk'@'HEAD' | sed -e :a -e '$!N;s/\n//;ta' -e 'P;D' [xmlRes] => <?xml version="1.0"?><log> )
Comment 15 by Loïc d'Anterroches, Mar 2, 2010
Phil, do you have a publicly available subversion repository where you can generate the error? If so, just give me the details that way I will be able to reproduce and fix the error.
Comment 16 by Phil Hord, Mar 2, 2010
Loic, I'm afraid I do not. My repository is an internal company server with about 5500 revisions checked in.
Comment 17 by Tomasz Jędrzejewski, Mar 3, 2010
In my case, the operating system data are: 1. The computer that works: Arch Linux, PHP 5.2.12, Subversion 1.6.9 2. The not-working computer: Debian Linux, PHP 5.2.6, Subversion 1.5.1 I'll check some publicly available repositories I own if there is the same problem.
Comment 18 by Loïc d'Anterroches, Mar 3, 2010
Hi Tomasz, that would be great, as soon as I can reproduce the bug I can nearly guarantee a fix.
Comment 19 by Vincent Tsao, Jun 8, 2010
I don't know if this is related to your problem, but I had the following happen to me and I found the cause for my problem. Basically Indefero was only crashing when I viewed the source of projects that I had restructured the SVN directory of. For example I had the following: http://myserver.com/svn/project1/ProjectWeb which I refactored to: http://myserver.com/svn/project1/trunk/ProjectWeb When I enabled debugging it was crashing when trying to execute the SVN command: svn log --xml --limit 1 --username='username' --password='password' ' http://myserver.com/svn/project1/trunk/ProjectWeb/'@'142' Where 142 is a revision before the restructuring of my directory. Upon further investigation it seemed that it was trying to find the old revision in the directory: /svn/project1/!svn/bc/142/trunk/ProjectWeb Essentially it's including the "trunk" in the path to the older revision, when it really should be: /svn/project1/!svn/bc/142/ProjectWeb I solved this by accessing the old revision in another way, specifically using the -r switch, as follows: svn log -r 142 --xml --limit 1 --username='username' --password='password' ' http://myserver.com/svn/project1/trunk/ProjectWeb/' and getting rid of the "@[rev]" at the end. This then retrieves the log of the old revision correctly. So I changed all the svn commands in .../indefero/src/IDF/Scm/Svn.php to use the -r switch instead of the @[rev] syntax. Now I don't really know that much about SVN so I'm not sure what the difference is between using the -r switch or the @ syntax. This solves my problem of accessing a project whose file structure has changed at some revision. With this I was also able to use Indefero to browse an older revision, however whenever I click on a file in the source browser (in the older revision) it brings me back to the HEAD instead of showing me that file from the old revision, not sure why. Anyways, let me know what you think of this.
Comment 20 by Loïc d'Anterroches, Jun 9, 2010
Great great great! Thanks a lot, you solved this issue!
Comment 21 by Thomas Keller, Jan 6, 2011
Whats the status of this issue?
Comment 22 by Thomas Keller, Mar 18, 2011
Taking this over. @Vincent: If you can provide a patch which works, I'll happily review and apply it.
Comment 23 by Vincent Tsao, Mar 18, 2011
Apologies, I haven't dealt with Indefero for a while now, the only information involving the fix I can give you is in my comment (Comment 19). Good luck!
Comment 24 by Thomas Keller, Mar 18, 2011
Ok, many thanks for your quick response!
Comment 25 by Thomas Keller, Mar 18, 2011
Could somebody with a real SVN setup smoke-test the attached patch, please?
Comment 26 by Thomas Keller, May 31, 2011
Patch has been tested and committed in revision 2aab4ee.