Moodle

chatd.php test for 'allow_call_time_pass_reference' setting can fail

Details

  • Type: Sub-task Sub-task
  • Status: Closed Closed
  • Priority: Minor Minor
  • Resolution: Duplicate
  • Affects Version/s: 1.7
  • Fix Version/s: 1.8.6, 1.9.1
  • Component/s: Chat
  • Labels:
    None
  • Environment:
    PHP 4.x if not others...
  • Affected Branches:
    MOODLE_17_STABLE
  • Fixed Branches:
    MOODLE_18_STABLE, MOODLE_19_STABLE

Description

I wondered why I was getting the PHP Warning about the 'allow_call_time_pass_reference' use being deprecated. Turns out
that the expliit test for a setting to 0, will not always work. init_get() is documented to return '0' or ''. The present code only
tests for '0',and will thus not warn invokers in all unsupported instances. I attach a context diff of a patch to fix this.

Activity

Hide
Dongsheng Cai added a comment -

Fixed in 1.8, 1.9 and HEAD, thanks James, feel free to reopen if any problem arises.

Show
Dongsheng Cai added a comment - Fixed in 1.8, 1.9 and HEAD, thanks James, feel free to reopen if any problem arises.
Hide
Eloy Lafuente (stronk7) added a comment -

Uhm, Dongsheng,

I think that setting was deprecated long time ago and perhaps, instead of looking at that value... we should declare those parameters to be passed by reference in function declaration, not relaying in that setting at all.

Can you research a bit more in chatd if we have properly declared what functions are using by-reference parameters and if we are declaring them properly ?

I really think it's the correct way. If we can guarantee that by-reference parameters are properly declared... then we should delete that check because for sure... will be dropped from PHP someday (or can be off by default in a lot of sites).

http://es2.php.net/manual/en/ini.core.php

Ciao

Show
Eloy Lafuente (stronk7) added a comment - Uhm, Dongsheng, I think that setting was deprecated long time ago and perhaps, instead of looking at that value... we should declare those parameters to be passed by reference in function declaration, not relaying in that setting at all. Can you research a bit more in chatd if we have properly declared what functions are using by-reference parameters and if we are declaring them properly ? I really think it's the correct way. If we can guarantee that by-reference parameters are properly declared... then we should delete that check because for sure... will be dropped from PHP someday (or can be off by default in a lot of sites). http://es2.php.net/manual/en/ini.core.php Ciao
Hide
Dongsheng Cai added a comment -

This issue will be resolved in MDL-14650.

Show
Dongsheng Cai added a comment - This issue will be resolved in MDL-14650.
Hide
Petr Škoda (skodak) added a comment -

code reviewed, closing

Show
Petr Škoda (skodak) added a comment - code reviewed, closing

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: