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

Undefined array key "currentUri" in [...]Mapped.php Line 68 when using @import (inline) #109

Closed
CSS-Regiogate opened this issue May 7, 2024 · 3 comments
Assignees
Labels
Type: Bug Something isn't working

Comments

@CSS-Regiogate
Copy link

I use (at)import (inline) to read the contents of a css file containing my container queries (since they are not yet supportet).
This worked fine up to version 4.2.1.
In Version 4.3.0 it breaks with "Undefined array key "currentUri" in [...]Mapped.php Line 68"

The reason is that in Import.php, Line 179 the empty array for $currentFileInfo has been replaced by one containing two keys, but not the "currentUri" key, leading to the mentioned error in Mapped.php, where this key is read without checking its existence. The only check here is if the array is not falsy.

@Krinkle Krinkle added the Type: Bug Something isn't working label May 8, 2024
@Krinkle
Copy link
Member

Krinkle commented May 8, 2024

Thank you for reporting this bug. Would you like to try to write a patch for this?

@tck
Copy link
Contributor

tck commented Nov 22, 2024

Maybe you can use my closed pull request as patch

@Krinkle
Copy link
Member

Krinkle commented Nov 22, 2024

@tck Thanks, I've imported patch at https://gerrit.wikimedia.org/r/c/mediawiki/libs/less.php/+/1094520/.

You can follow the issue at https://phabricator.wikimedia.org/T380641.

Krinkle pushed a commit that referenced this issue Jan 6, 2025
… (inline)`

When enabling source maps and an input file uses `@import (inline)`,
then the source map generation causes this error because not all
chunks have file info metadata associated in that case.

This matches upstream behaviour at
* Output Mapped:
  https://github.com/less/less.js/blob/v3.13.1/packages/less/src/less/source-map-output.js#L89
* Generator:
  https://github.com/mozilla/source-map/blob/v0.7.4/lib/source-map-generator.js#L110-L129

Without the changes in lib/, the new test case fails with:

```
1) MapTest::testImportInline
Undefined array key "currentUri"

/less.php/lib/Less/Output/Mapped.php:68
…
/less.php/lib/Less/SourceMap/Generator.php:118
/less.php/lib/Less/Parser.php:235
/less.php/test/phpunit/MapTest.php:37
```

Ref #109.
Closes #121.

Bug: T380641
Change-Id: I2e04e33facd6f900c147c124e9931ffc2cac5551
@Krinkle Krinkle self-assigned this Jan 9, 2025
@Krinkle Krinkle closed this as completed Jan 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Something isn't working
Development

Successfully merging a pull request may close this issue.

3 participants