2951: Function context detection doesn't work for PHP

pebble******@gmai***** (Google Code) (Is this you? Claim this profile.)
david
david
Jan. 31, 2014
What version are you running?
Review Board 1.6.3

What's the URL of the page containing the problem?
http://www.example.com/r/XXX/diff

What steps will reproduce the problem?
1. Open a review in browser and go to Diff view.
2. Click on a line number to comment inside PHP class's function.
3. Add the comment and check the review.

What is the expected output? What do you see instead?
It should always give the actual function name as reference.

What operating system are you using? What browser?
Windows 7, Internet Explorer 9

Please provide any additional information below.
File reviewed is complete OO code file of PHP programming language. This is a new file created so the diff is from self only. 
The file contains namespace, class declaration with "extends" and interface "implements".
There are multiple functions in the class.

The problem seems to be that no matter on what function's line you comment on it will first function declaration as reference. And if you comment on first function then it will take class declaration as reference.

Something like his:

<?php

class myClass {

	public function __constrcut() {
		//	Do ABC
		//	Do XYZ
		//	Give 123
	}

	public funciton abc() {
		//	Do something

		//	Again do something

		//	Again do something
	}

	public function problem_is_here() {
		unset(self::$conn);
	}

}

?>

And if I put a comment on "unset(self::$conn);" It will give something like this:

function __construct() {
73	        unset(self::$conn);
david
#1 david
  • +Component-DiffViewer
  • +Function context detection doesn't work for PHP
#3 sr.mag******@tens***** (Google Code) (Is this you? Claim this profile.)
The same problem with "python" code.
#4 sr.mag******@tens***** (Google Code) (Is this you? Claim this profile.)
> The same problem with "python" code.

On Review Board 1.7.13
david
#5 david
Python should *definitely* be supported. Please provide examples of what you see and what you expect to see.
#6 sr.mag******@tens***** (Google Code) (Is this you? Claim this profile.)
See rb1.jpg (http://reviews.mycompany.ru/r/91/#)
It shows that we are in "def feed_data".

See rb2.jpg (http://reviews.mycompany.ru/r/91/diff/2/?file=143#file143line125)
It shows that we are really NOT in "def feed_data".
david
#7 david
  • +PendingReview
  • +david
david
#8 david
Fixed in master (3166667). This will ship with 2.0 rc1
  • -PendingReview
    +Fixed