Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FIX: handle undefined cookie value for virtual card expansion, refact… #33048

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from

Conversation

Maxenor
Copy link

@Maxenor Maxenor commented Feb 13, 2025

Fix "Undefined array key" warning and remove debug output in virtualcard.php

Summary

Replaced direct access to $_COOKIE['virtualcard_expand'] with the null coalescing operator to avoid the "Undefined array key" warning.

Why

Undefined array key warning: Accessing $_COOKIE['virtualcard_expand'] directly triggered a warning if the cookie didn’t exist.

@defrance

@@ -17,6 +17,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/

ob_start();
Copy link
Member

@eldy eldy Feb 13, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use of ob_start lead to difficulty to understand and debug.
We should not need this for common pages.
Can you describe why you need this ?

According to description of bug, only the
$expand = $_COOKIE['virtualcard_expand'] ?? null;
should be required

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello, there were multiple errors displaying on the virtual card page with headers already sent by the main.inc.php file. It helps prevent "headers already sent" errors by delaying the actual sending of output until the page's ready, allowing to modify headers at any point before the flush.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello, there were multiple errors displaying on the virtual card page with headers already sent by the main.inc.php file. It helps prevent "headers already sent" errors by delaying the actual sending of output until the page's ready, allowing to modify headers at any point before the flush.

If we have error "headers already sent", it is better to fix them by not sending data before the header instead of adding a hack to hide it.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Maxenor and if multiple errors... fix this errors ! ;-)

@eldy eldy added the Discussion Some questions or discussions are opened and wait answers of author or other people to be processed label Feb 13, 2025
eldy added a commit that referenced this pull request Feb 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Discussion Some questions or discussions are opened and wait answers of author or other people to be processed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants