Advertisement:

Author Topic: [] operator not supported for strings  (Read 562 times)

Offline inter

  • Jr. Member
  • **
  • Posts: 282
  • Gender: Male
    • interlab on GitHub
[] operator not supported for strings
« on: January 25, 2018, 04:36:43 AM »
smf 2.0.15
php 7.1

Code: [Select]
    $test = 'test';
    $test[] = 123;

Quote
[] operator not supported for strings

http://.../index.php?action=admin;area=logs;sa=errorlog

Error Log  is empty!

Sorry for my English

Offline Aleksi "Lex" Kilpinen

  • Support Specialist
  • SMF Super Hero
  • *
  • Posts: 16,323
  • Gender: Male
  • Don't worry, I'm n00b friendly
    • Aleksi.Kilpinen on Facebook
    • aleksi-kilpinen on LinkedIn
Re: [] operator not supported for strings
« Reply #1 on: January 25, 2018, 04:47:16 AM »
So you think you found a bug with SMF?

How to reproduce said error in a clean SMF installation?
A Finnish Support Specialist
 Happily running multiple SMF 2.0 installations.

"Before you allow people access to your forum, especially in an administrative position, you must be aware that that person can seriously damage your forum.
 Therefore, you should only allow people that you trust, implicitly, to have such access." -Douglas

Offline d3vcho(void)

  • Localizer
  • SMF Hero
  • *
  • Posts: 2,374
  • Gender: Male
  • Be prepared for hell
    • d3vcho on GitHub
    • @SMF_ES on Twitter
Re: [] operator not supported for strings
« Reply #2 on: January 25, 2018, 04:52:25 AM »
Actually it's a known error already solved for SMF 2.1, but I don't know why we didn't apply the fix for 2.0.15

https://www.simplemachines.org/community/index.php?topic=554723.0

Offline inter

  • Jr. Member
  • **
  • Posts: 282
  • Gender: Male
    • interlab on GitHub
Re: [] operator not supported for strings
« Reply #3 on: January 25, 2018, 05:07:14 AM »
So you think you found a bug with SMF?

How to reproduce said error in a clean SMF installation?

added my code for your action function.

perhaps you do not understand - you have an error in the module, but the log does not register it. the administrator does not know about it at all. I accidentally found her yesterday and it's very unpleasant.

I at myself have corrected it so:
index.php
replace this:
Code: [Select]
// Quickly catch random exceptions.
set_exception_handler(function ($e) use ($db_show_debug)
{
if (isset($db_show_debug) && $db_show_debug === true && allowedTo('admin_forum'))
fatal_error(nl2br($e), false);
else
fatal_error($e->getMessage(), false);
});
on:
Code: [Select]
// Quickly catch random exceptions.
set_exception_handler(function ($e) use ($db_show_debug)
{
    if (isset($db_show_debug) && $db_show_debug === true
        && allowedTo('admin_forum')
    ) {
fatal_error(nl2br($e));
} else {
fatal_error($e->getMessage());
    }
});
Sorry for my English