Throwing it out there

Noticed i was Using latest PHP7 :

Deprecated function: Methods with the same name as their class will not be constructors in a future version of PHP; ctools_context has a deprecated constructor in require_once() (line 127 of sites/all/modules/contrib/ctools/ctools.module).

Deprecated function: Methods with the same name as their class will not be constructors in a future version of PHP; ctools_context_required has a deprecated constructor in require_once() (line 127 of sites/all/modules/contrib/ctools/ctools.module).

Deprecated function: Methods with the same name as their class will not be constructors in a future version of PHP; ctools_context_optional has a deprecated constructor in require_once() (line 127 of sites/all/modules/contrib/ctools/ctools.module).

Comments

pganore1@gmail.com created an issue. See original summary.

joco_sp’s picture

I also have this problem when upgrading to PHP7

jackbravo’s picture

Status: Active » Closed (duplicate)

This is a duplicate of #2528736: Deprecating PHP4 style constructors which has already been fixed =). Next release will probably contain the fix.

deepak_thorat’s picture

Deprecated function: Methods with the same name as their class will not be constructors in a future version of PHP; ctools_context has a deprecated constructor in require_once() (line 127 of E:\xampp\htdocs\drupalapitest\sites\all\modules\ctools\ctools.module).
Deprecated function: Methods with the same name as their class will not be constructors in a future version of PHP; ctools_context_required has a deprecated constructor in require_once() (line 127 of E:\xampp\htdocs\drupalapitest\sites\all\modules\ctools\ctools.module).
Deprecated function: Methods with the same name as their class will not be constructors in a future version of PHP; ctools_context_optional has a deprecated constructor in require_once() (line 127 of E:\xampp\htdocs\drupalapitest\sites\all\modules\ctools\ctools.module).

I am getting this error in php 7 version . How i can solved to this issue any solution plz suggest to me
Many thanks...

mozh92’s picture

jackbravo, I find classes in cTools includes/context.inc

and change line 45:
-function ctools_context($type = 'none', $data = NULL) {
+function __construct($type = 'none', $data = NULL) {

line 122
-function ctools_context_required($title) {
+function __construct($title) {

line 207
-function ctools_context_optional() {
+function __construct() {

and it helped me!

rgnyldz’s picture

#5 helped me too

frank hh-germany’s picture

The latest dev from 19.02.2016 fix the problem

frank hh-germany’s picture

#5
changing line 207
Warning: call_user_func_array() expects parameter 1 to be a valid callback, class 'ctools_context_optional' does not have a method 'ctools_context_required' in ctools_context_optional->__construct() (line 209 of /profiles/commerce_kickstart/modules/contrib/ctools/includes/context.inc).

Copy the context.inc from the latest dev over the old context.inc fix the problem.

fizk’s picture

vijayan08’s picture

I find classes in cTools includes/context.inc
and change line 45:
-function ctools_context($type = 'none', $data = NULL) {
+function __construct($type = 'none', $data = NULL) {

line 122
-function ctools_context_required($title) {
+function __construct($title) {

line 207
-function ctools_context_optional() {
+function __construct() {

views/includes/handlers.inc

line 761
-function views_many_to_one_helper(&$handler) {
+function __construct(&$handler) {

issue resolved for me

joelpittet’s picture

@vijayan.nat this was resolved in newer versions of ctools.