Skip to content

[BUG] Unable To Find External Dependencies on Case-Sensitive Systems - #2499

Closed
Fenikkusu wants to merge 5 commits into
zephir-lang:developmentfrom
twistersfury:hotfix/external-classes
Closed

[BUG] Unable To Find External Dependencies on Case-Sensitive Systems#2499
Fenikkusu wants to merge 5 commits into
zephir-lang:developmentfrom
twistersfury:hotfix/external-classes

Conversation

@Fenikkusu

@Fenikkusu Fenikkusu commented Apr 24, 2026

Copy link
Copy Markdown
Contributor

Hello!

In raising this pull request, I confirm the following:

  • I have checked that another pull request for this purpose does not exist
  • I wrote some tests for this PR
  • I updated the CHANGELOG

Many of my Zephir Projects extend or leverage Phalcon. I recently made a change to a project where I extended Phalcon\Support\Collection. I found, though, that if I called the "get" method, I was getting the error called with a wrong number of parameters, the method has: 2, passed: 1

I loaded up Claude and started digging into the issue, and finally determined that this was the result of a combination of two bugs. The first bug (that this PR attempts to fix) is that when Zephir tries to load a class from external-dependencies in the config.json, it calls strtolower on the path. The issue is that on case-sensitive file systems, this check fails for Phalcon files because the raw files are capitalized. IE: The class Phalcon\Support\Collection was "mapping" to /opt/cphalcon/phalcon/support/collection.zep, which doesn't exist because the actual path was /opt/cphalcon/phalcon/Support/Collection.zep.

The second bug, which I'm not fixing at this time, but may still be required, is that it falls back to Reflection when it cannot find the class. In this case, Zephir uses the isset method in Method::getNumberOfRequiredParameters. The issue is that if the default value is null, as is the case in Collection::get, isset returns false.

This PR fixes the first issue, which should make the second issue a moot point. I have confirmed that after applying this fix, my project started to compile as expected. It is done in such a way as to allow backwards compatibility.

@Fenikkusu

Copy link
Copy Markdown
Contributor Author

ZEPHIR_LOAD_EXTERNAL.md

Context From Claude Code

@Fenikkusu Fenikkusu changed the title Hotfix/external classes [BUG] Unable To Find External Dependencies on Case-Sensitive Systems Apr 24, 2026
@Fenikkusu

Copy link
Copy Markdown
Contributor Author

I'm tired, and it's far past my bedtime. I will get the PR cleaned up tomorrow. I couldn't find (quickly) where the automated test for Compile is, so if someone wants to point me in the right direction, I'll get that handled too (I feel like I've asked that before...)

@Fenikkusu
Fenikkusu force-pushed the hotfix/external-classes branch from bb67fbf to 247378e Compare May 16, 2026 21:25
@sonarqubecloud

Copy link
Copy Markdown

@Jeckerson

Copy link
Copy Markdown
Member

Closing in favour of #2556

@Jeckerson Jeckerson closed this May 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants