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

Attempt to read property ... on null in blame.php #197

Closed
danielmarschall opened this issue Nov 6, 2023 · 2 comments
Closed

Attempt to read property ... on null in blame.php #197

danielmarschall opened this issue Nov 6, 2023 · 2 comments

Comments

@danielmarschall
Copy link
Contributor

danielmarschall commented Nov 6, 2023

The following problem has been found in my PHP error log

blame.php

Warning: Attempt to read property "date" on null in /daten/homes/svn/public_html/websvn/blame.php on line 247
Warning: Attempt to read property "msg" on null in /daten/homes/svn/public_html/websvn/blame.php on line 247

One instance is found here:
https://svn.viathinksoft.com/websvn/blame.php?path=%2Ftags%2FUserDetect2_Release_2.0%2FPlugins%2FExecuteAlways.dpr&repname=userdetect2&rev=70
(svn co https://svn.viathinksoft.com/svn/userdetect2/trunk)

Just a theory: Is it possible that the invalid UTF-8 character "Immer ausf�hren" is the reason why blame.php fails? (The file is ISO-8859-1 formatted)

@michael-o
Copy link
Member

I have found the reason for the blame issue:
You request the file at peg revision 71: https://svn.viathinksoft.com/websvn/blame.php?path=%2Ftags%2FUserDetect2_Release_2.0%2FPlugins%2FExecuteAlways.dpr&repname=userdetect2&rev=71.
This is translated to:

/usr/local/bin/svn --non-interactive --config-dir /usr/local/etc/websvn/subversion log --xml --limit 1 -r 68:68 'https://svn.viathinksoft.com/svn/userdetect2/tags/UserDetect2_Release_2.0/Plugins/ExecuteAlways.dpr@71'
/usr/local/bin/svn --non-interactive --config-dir /usr/local/etc/websvn/subversion log --xml --limit 1 -r 69:69 'https://svn.viathinksoft.com/svn/userdetect2/tags/UserDetect2_Release_2.0/Plugins/ExecuteAlways.dpr@71'
/usr/local/bin/svn --non-interactive --config-dir /usr/local/etc/websvn/subversion log --xml --limit 1 -r 70:70 'https://svn.viathinksoft.com/svn/userdetect2/tags/UserDetect2_Release_2.0/Plugins/ExecuteAlways.dpr@71'
/usr/local/bin/svn --non-interactive --config-dir /usr/local/etc/websvn/subversion log --xml --limit 1 -r 71:71 'https://svn.viathinksoft.com/svn/userdetect2/tags/UserDetect2_Release_2.0/Plugins/ExecuteAlways.dpr@71'

Now the problem is that the tag you have created started to exist only at revision 75, thus the peg revision 71 points to a non-existing file:

# /usr/local/bin/svn --non-interactive --config-dir /usr/local/etc/websvn/subversion log --xml --limit 1 -r 68:68 'https://svn.viathinksoft.com/svn/userdetect2/tags/UserDetect2_Release_2.0/Plugins/ExecuteAlways.dpr@71'
<?xml version="1.0" encoding="UTF-8"?>
<log>
svn: E160013: '/svn/userdetect2/!svn/rvr/71/tags/UserDetect2_Release_2.0/Plugins/ExecuteAlways.dpr' path not found
# /usr/local/bin/svn --non-interactive --config-dir /usr/local/etc/websvn/subversion log --xml --limit 1 -r 69:69 'https://svn.viathinksoft.com/svn/userdetect2/tags/UserDetect2_Release_2.0/Plugins/ExecuteAlways.dpr@71'
<?xml version="1.0" encoding="UTF-8"?>
<log>
svn: E160013: '/svn/userdetect2/!svn/rvr/71/tags/UserDetect2_Release_2.0/Plugins/ExecuteAlways.dpr' path not found
# /usr/local/bin/svn --non-interactive --config-dir /usr/local/etc/websvn/subversion log --xml --limit 1 -r 70:70 'https://svn.viathinksoft.com/svn/userdetect2/tags/UserDetect2_Release_2.0/Plugins/ExecuteAlways.dpr@71'
<?xml version="1.0" encoding="UTF-8"?>
<log>
svn: E160013: '/svn/userdetect2/!svn/rvr/71/tags/UserDetect2_Release_2.0/Plugins/ExecuteAlways.dpr' path not found
# /usr/local/bin/svn --non-interactive --config-dir /usr/local/etc/websvn/subversion log --xml --limit 1 -r 71:71 'https://svn.viathinksoft.com/svn/userdetect2/tags/UserDetect2_Release_2.0/Plugins/ExecuteAlways.dpr@71'
<?xml version="1.0" encoding="UTF-8"?>
<log>
svn: E160013: '/svn/userdetect2/!svn/rvr/71/tags/UserDetect2_Release_2.0/Plugins/ExecuteAlways.dpr' path not found

One cannot know upfront whether the item existed at that peg revision. If you blame without peg revision all is fine.

This snippet

websvn/blame.php

Lines 235 to 238 in f60054d

if (empty($peg))
{
$peg = $rev;
}
is responsible for the issue. I cannot really say whether this hunk is wrong or right.

So one either remove this if clause or check whether $history->curEntry is not null.

WDYT?

michael-o added a commit that referenced this issue Nov 6, 2023
Skip entry if the current item does not have a current history entry. This can
happen if the item does not exist at the requested peg revision.

This fixes #197
@danielmarschall
Copy link
Contributor Author

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

Successfully merging a pull request may close this issue.

2 participants