PHP Notice
-
Thanks for the plugin!
Running the Query Monitor plugin, I am getting the following message when I am on the admin pages:
Notice Undefined offset: 1 wp-content/plugins/s2member-secure-file-browser/class/psk_s2msfb.admin.class.php:84In case it matters, I am running PHP 7.0.
-
I think this is indeed connected to PHP 7. If I turn off Query Monitor, I get the following PHP7 warning:
Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; PSK_S2MSFB_wdgt_download has a deprecated constructor in ~/wp-content/plugins/s2member-secure-file-browser/class/psk_s2msfb.widgets.class.php on line 34 Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; PSK_S2MSFB_wdgt_files has a deprecated constructor in ~/wp-content/plugins/s2member-secure-file-browser/class/psk_s2msfb.widgets.class.php on line 670To fix the deprecated warnings, make the following changes in this file:
~/wp-content/plugins/s2member-secure-file-browser/class/psk_s2msfb.widgets.class.phpOn line 42, change
function PSK_S2MSFB_wdgt_download() {
to
function __construct() {On line 676, change
function PSK_S2MSFB_wdgt_files() {
to
function __construct() {Hi !
Sorry I am a little bit swamped these days, I will release a new version as soon as possible with this fix.
And… thank you for reporting and for the fix !
I understand. It’s good that you’re so busy!
Unfortunately, my fix only address the deprecated warnings and not the original notice about an “undefined offset”
It turns out that there are several PHP notices being thrown. I think I have now found and fixed all the others besides the deprecated notices fix I already posted. The remaining fixes are as follows:
In
s2member-secure-file-browser/class/psk_s2msfb.admin.class.phpon line 84, change@list( $parent , $child ) = @explode( '_' , $page );to
list( $parent , $child ) = array_pad( explode( '_' , $page, 2 ), 2, null );On line 67, change
@list( $psk , $admin , $screen , $parent , $child ) = @explode( '_' , $method );to
list( $psk , $admin , $screen , $parent , $child ) = array_pad( explode( '_' , $method, 5 ), 5, null);On line 68, change
$parent = ( isset( self::$admin_menu[ 'left' ][ $parent ] ) ) ? self::$admin_menu[ 'left' ][ $parent ] : @self::$admin_menu[ 'right' ][ $parent ];to
$parent = ( isset( self::$admin_menu[ 'left' ][ $parent ] ) ) ? self::$admin_menu[ 'left' ][ $parent ] : isset( self::$admin_menu[ 'right' ][ $parent ] );In
s2member-secure-file-browser/class/psk_s2msfb.admin.stats.class.phpon lines 141, 283, and 406, changeswitch ( @$_GET[ 't' ] ) {to
switch ( isset( $_GET[ 't' ] ) ) {On line 437, change
$user = $row[ 'useremail' ] . ' - #' . $row[ 'userid' ];to
$user = isset( $row[ 'useremail' ] ) . ' - #' . $row[ 'userid' ];In
s2member-secure-file-browser/class/psk_s2msfb.class.phpon line 1294, changeif ( @$atts[ 'displaydownloaded' ] == '1' ) {to
if ( isset( $atts[ 'displaydownloaded' ] ) == '1' ) {On line 1302, change
if ( @$atts[ 's2alertbox' ] == '1' ) {to
if ( isset( $atts[ 's2alertbox' ] ) == '1' ) {On line 1323, change
if ( @$atts[ 'displaydownloaded' ] == '2' ) {to
if ( isset( $atts[ 'displaydownloaded' ] ) == '2' ) {On line 1327, change
} else if ( @$atts[ 'displaydownloaded' ] == '1' ) {to
} else if ( isset( $atts[ 'displaydownloaded' ] ) == '1' ) {I have changes these block of codes but in a different way.
I don’t figure out how
if ( isset( $atts[ 'displaydownloaded' ] ) == '2' )can be true given thatissetreturns a boolean.There still are a lot of
@. Is it the problem with PHP7 ?I haven’t addressed all the
@— only where Query Monitor was flagging a problem. I think part of the issue (for me, at least) is PHP7, and part is that Query Monitor was recently updated to detect more of these things. Since my testing site is already on PHP7, I don’t know if they would show up on PHP5.5 or whatever.Surely
if ( isset( $atts[ 'displaydownloaded' ] ) == '2' )can be true if it is true that 2 is returned?Ok version 0.4.19 is being transmitted. As soon as you will upgrade, tell me if it is ok for you!
Yes, it’s looking great now! Thanks very much!
The topic ‘PHP Notice’ is closed to new replies.