Download & Extend

Code from documentation is causing PHP notices

Project:Views
Version:7.x-3.x-dev
Component:Documentation
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed (fixed)

Issue Summary

I came across a module today that has copy-pasted some of the documentation on handlers to get started. I do that all the time myself and I love it when modules provides a "starter" like that.

* @code
* class views_join_complex extends views_join {
*   // PHP 4 doesn't call constructors of the base class automatically from a
*   // constructor of a derived class. It is your responsibility to propagate
*   // the call to constructors upstream where appropriate.
*   function construct($table, $left_table, $left_field, $field, $extra = array(), $type = 'LEFT') {
*     parent::construct($table, $left_table, $left_field, $field, $extra, $type);
*   }
*
*   function build_join($select_query, $table, $view_query) {
*     $this->extra = 'foo.bar = baz.boing';
*     parent::build_join($select_query, $table, $view_query);
*   }
* }
* @endcode

But it seems that the snippet is causing PHP notices by code called by views itself. In line 118 og handlers.inc the constructor is called with no arguments.

Patch puts default arguments (NULL) in all arguments to the constructor.

AttachmentSizeStatusTest resultOperations
default_arguments_constructor.patch800 bytesIdlePASSED: [[SimpleTest]]: [MySQL] 1,603 pass(es).View details

Comments

#1

Status:needs review» reviewed & tested by the community

This certainly fixes something :) Thanks for the patch!

#2

Status:reviewed & tested by the community» fixed

Perfect! Committed and pushed.

#3

Status:fixed» closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

nobody click here