[GH-ISSUE #1583] [ERROR] WiFiManagerParameter is out of scope BUT it's not out of scope #1353

Closed
opened 2026-02-28 01:29:43 +03:00 by kerem · 3 comments
Owner

Originally created by @olonsoft on GitHub (Apr 8, 2023).
Original GitHub issue: https://github.com/tzapu/WiFiManager/issues/1583

I was puzzled by this problem for one week until I found it was not my code's fault.

I kept getting [ERROR] WiFiManagerParameter is out of scope while I was trying to save my custom parameters.
I completely refactored my code many times, but the result was the same.

I could successfully load the parameters and display them while starting the webportal but when I was saving them, there was the mentioned error.

Debugging wm code I saw that in function

void WiFiManager::doParamSave(){
...
if (_params[i] == NULL || _params[i]->_length == 0) {

the _length was always 0.

In a similar function getParamOut() the if is

if (_params[i] == NULL || _params[i]->_length > 99999) {

So I changed the doParamSave() code to

if (_params[i] == NULL || _params[i]->_length > 99999) {

and now my application works without a problem.

Using the latest version as of 2023-04-08

Originally created by @olonsoft on GitHub (Apr 8, 2023). Original GitHub issue: https://github.com/tzapu/WiFiManager/issues/1583 I was puzzled by this problem for one week until I found it was not my code's fault. I kept getting `[ERROR] WiFiManagerParameter is out of scope` while I was trying to save my custom parameters. I completely refactored my code many times, but the result was the same. I could successfully load the parameters and display them while starting the webportal but when I was saving them, there was the mentioned error. Debugging wm code I saw that in function ```c++ void WiFiManager::doParamSave(){ ... if (_params[i] == NULL || _params[i]->_length == 0) { ``` the `_length` was always 0. In a similar function `getParamOut()` the `if` is `if (_params[i] == NULL || _params[i]->_length > 99999) {` So I changed the `doParamSave()` code to `if (_params[i] == NULL || _params[i]->_length > 99999) {` and now my application works without a problem. Using the latest version as of 2023-04-08
kerem closed this issue 2026-02-28 01:29:43 +03:00
Author
Owner

@CircuitSetup commented on GitHub (May 2, 2023):

I just ran into the same issue, and this solved it. It seems like that check isn't doing what it's supposed to under certain conditions. I'm not sure what that condition is though.

<!-- gh-comment-id:1532033100 --> @CircuitSetup commented on GitHub (May 2, 2023): I just ran into the same issue, and this solved it. It seems like that check isn't doing what it's supposed to under certain conditions. I'm not sure what that condition is though.
Author
Owner

@realA10001986 commented on GitHub (May 2, 2023):

That happens with customHTML-WiFiManagerParameter parameters, and is clearly a regression.

The _length field of such Parameters is now set to 0 (previously it was set to 1) in WiFiManagerParameter::WiFiManagerParameter(const char *custom), see line 34 of WiFiManager.cpp.

If _length 0 is now a thing, the OP is correct as to change the check.

<!-- gh-comment-id:1532065102 --> @realA10001986 commented on GitHub (May 2, 2023): That happens with customHTML-WiFiManagerParameter parameters, and is clearly a regression. The _length field of such Parameters is now set to 0 (previously it was set to 1) in WiFiManagerParameter::WiFiManagerParameter(const char *custom), see line 34 of WiFiManager.cpp. If _length 0 is now a thing, the OP is correct as to change the check.
Author
Owner

@burner- commented on GitHub (Dec 10, 2023):

Looks that this is closed at May 2 but not fixed in May 11 release. Advanced example ino wont work properly because of this bug.

<!-- gh-comment-id:1849041049 --> @burner- commented on GitHub (Dec 10, 2023): Looks that this is closed at May 2 but not fixed in May 11 release. Advanced example ino wont work properly because of this bug.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/WiFiManager#1353
No description provided.