'Sync Extensions with Interpreter' button unchecks many already-checked extensions...

I just set up a new CLI Interpreter, and I noticed in the PHP Runtime tab, a button named 'Sync Extensions with Interpreter'; to be safe, I looked up the name and found this this doc (thankfully using the same button name): 

https://www.jetbrains.com/help/phpstorm/php.html#php-runtime-tab

It says: "To load the set of stubs that matches the set of loaded extensions for the currently configured CLI interpreter, click the Sync Extensions with Interpreter button."

OK, so to me this means "PHPStorm will check the boxes in each section (Core, Bundled, External, PECL, Other) of extensions that the interpreter has loaded, and uncheck ones that aren't loaded."

Since my `php -v` and phpinfo() shows the correct version and paths, I know that it's hitting the correct places.

However, when I actually click the button, with PECL opened and various boxes checked, it unchecks them all and shows a green pop-up saying it enabled 0 and disabled 82 extensions:

Why would it do this when it had a bunch checked? I assumed PHPStorm upon being told which php file interpreter to use would already check loaded extensions and check boxes for loaded ones it found, when instead it seems to either pre-check some assumed defaults (based on what?) or has misread which are loaded at the time of interpreter selection or when I clicked the button...

Since I didn't note which were already checked, I don't know if any of them should be for PHPStorm to behave right for me where this applies... 

Deleting the CLI interpreter (in settings of course) and re-creating it (always for the IDE, not just the Project) didn't re-check anything... it left them all the way the previous setup did. Now I'm worried. I don't want a desynchonization in validation or tracing with the editor and the server site, and I don't know what to do now.

What is happening that's correct here? Otherwise, what is going wrong? What do I do now?

9 comments
Comment actions Permalink

There shouldn't be a desynchronization between the editor & remote site because PhpStorm effectively has read which extension were enabled in your server php.ini & which were not. 

Do you have any PECL extensions installed in that project? If not - then you have nothing to worry about.

0
Comment actions Permalink

I know bad things shouldn't happen, but something isn't right, and I already assumed that PHPStorm read which extensions were enabled because it had many pre-checked... which is why I'm pointing out the bizarre behavior of them becoming all unchecked upon Sync click.

How do I know which is correct?! When they were checkmarked or when they became uncheckmarked? Or are those particular pre-checkmarked libraries always checkmarked to begin with regardless of any first automatic scan even happening? It's at the very least confusing-looking, and I can't tell which is accurate now. I could cross-compare the ini file, but at the very least PHPStorm is misbehaving showing inaccurate info one way or another (either when I first looked at it or after Sync click). Do you see what I'm saying?

We haven't installed any PECL extensions to the project. It's all just in the repo and anything else is added using composer, neither of which modify php.ini extensions. I use MAMP which has its own settings in php.ini, but it seems PHPStorm isn't getting an accurate read on them either when I see many of the extensions checkmarked at first or when they all become unchecked after clicking Sync. I hope the problem here isn't too difficult to understand.

0
Comment actions Permalink

Yes, PhpStorm comes with a whole bunch of PECL extensions enabled for code completion by default. By default they will be suggested even if you don't have these extensions installed. Do you see this as a problem? I don't see any complaints regarding this. Besides: not everyone is adding a production (or production-like) CLI interpreter to PhpStorm to sync the extensions, but they are still using PECL-related code completion that comes by default. Changing this behavior could cause major inconveniences for our users.

I also went ahead and checked if installing/removing PECL extensions works correctly & can confirm that it works as it should: installing PECL extension & then clicking "Sync..." adds a corresponding checkmark in the list.

If you're sure that "it seems PHPStorm isn't getting an accurate read" - please attach some screenshots that could prove that so that we could reproduce this & fix.

0
Comment actions Permalink

Maybe it's hard for you to understand the user perspective, which is what I'm describing, the inconsistency I'm pointing out here, because you're already used to how the editor thinks under the surface regardless of that being apparent to the user in the interface... 

If you can't even see the problem here, even if it's just an appearance issue, please show my description to someone else on the team, so they can consider what I'm describing from a user perspective. You seem to be very un-understanding of our perspective as if we should already understand what you do from your perspective. We as users can't be expected to already understand the editor's logic and what you as helpers know when it's showing inconsistent or counter-intuitive or unintuitive output, and I get tired of having to re-explain to supposed helpers in a community why something doesn't look right when they can't/won't accept how something looks to a user.

So you're saying that the checkmarked boxes were just suggestions, not what the editor already had scanned and found in the php.ini my server was running (which is a probable assumption for users to make, based on appearances), and that when I clicked Sync, it finally actually did a scan (why wouldn't have done it automatically already?), and found ZERO extensions enabled in the php.ini? Or you're saying that it couldn't even figure out how to identify them for some reason...

Your suggestion of installing/removing PECL extensions showed Sync reflected that... I didn't install any of the extensions, and I'm not going to try installing/removing any even as a test for that reason. I'm just gonna take your word on how it works, and that it's not a useful feature for me to even try to play with, because it's not behaving consistently or intuitively, so I can't tell what it's actually doing or if something is wrong. I've already wasted too much time on this issue and am apparently in the wrong for not already knowing a bunch of pre-loaded info that you're already used to.

0
Comment actions Permalink

IDE found zero PECL extensions to enable, not zero extensions in general. If you take a look to PHP Runtime tab there you may notice that they are grouped: Core, Bundled, External, PECL & Others. 

I understand your point of view, sorry if that doesn't look like it. I'm trying to answer your questions & clarify the matters discussed here. But looks like this is not bringing us closer to a solution.

A solution in that particular case perhaps would be the following: when a user adds a PHP Interpreter - perform "Sync Extensions with Interpreter" automatically. Would that address your concerns?

0
Comment actions Permalink

> IDE found zero PECL extensions to enable, not zero extensions in general.

I only looked at the PECL and Other sections when looking at checkmarked boxes before and after clicking Sync... and they both behaved the same way, so the inconsistent display is not just within PECL.

Regardless, you said: "There shouldn't be a desynchronization between the editor & remote site because PhpStorm effectively has read which extension were enabled in your server php.ini & which were not." So... there obviously is a desynchronization somewhere, because many of the boxes were checkmarked before I clicked Sync, then they all went unchecked afterword.

> If you take a look to PHP Runtime tab there you may notice that they are grouped: Core, Bundled, External, PECL & Others. 

I know 😆 I showed you the screenshot of that... I'd already expanded the PECL section... you don't need to describe to me what I showed you. I was not confusing PECL with overall... I was just using PECL as an example because that just happened to be the one I clicked to open to see what was in it. Then after reading what the Sync button did, the behavior looked contradictory. It didn't matter which exact section I'd already clicked open, multiple sections behaved the same strange way.

Notice here, again, but in the External section, multiple boxes are checked... they look completely random to me. I'm making zero assumptions about them now, though it seems obvious and normal to assume that this means that PHPStorm already scanned and determined that these were available/enabled in the PHP Runtime (hence the name of the tab), just like with any other sections like the PECL one or the Other one... see what I'm saying now?

Clicking 'Sync Extensions with Interpreter' it now behaves even more inconsistently; it says Enabled 0 and disabled 1, but nothing changes in the External section, and PECL and Other remain completely unchecked, no matter which PHP Language Level or CLI Interpreter I set.

So, why initially did it uncheck all of PECL and Other (when seemingly random boxes were checked), but doesn't do that with other sections, and I now can't get it back into a state of where any boxes in PECL or Other were checked... 

Do you see the confusion here?

  1. Why were multiple boxes under PECL and Other checked to begin with?
  2. Why were all boxes unchecked for those two sections when Sync was clicked?
  3. Why when clicking Sync, all checkboxes are not unchecked under External?

Again, I'm just using these as examples, because they're just the ones I've expanded when seeing how Sync worked. Do you understand why I'm concerned about the strange behavior?

Maybe you should review the documentation again and explain which part of it I'm misunderstanding if this inconsistent and unintuitive behavior is completely expected.

PS, I just need validation and stubs and tracing to work for PHP 5, PHP 7, and PHP 8 (depending on the repo of course) until our clients all get up to date. Then it will be easier to work with PHPStorm and its settings.

0
Comment actions Permalink

1. That's a default checkbox state PhpStorm comes with

2. Sorry can't say anything without an actual data on my hands. My assumption - those PECL & Other extensions were not installed for a given PHP Interpreter. To actually look into this please:

- run php -m using a PHP Interpreter in question and share the output

- show a screenshot of PECL & Other checkboxes group state after pressing "Sync with...". I saw only a part of "PECL" on your screenshot

3. Because some of the "External" extensions are installed? We can see that by comparing the php -m output & screenshot of "External" extensions section.

 

0
Comment actions Permalink

> That's a default checkbox state PhpStorm comes with

OK, thank you, that clarifies the initial state in relation to the post-click Sync state.

> My assumption - those PECL & Other extensions were not installed for a given PHP Interpreter.

Probably so. I just don't know why PHPStorm has checkmarks on some things even as a 'default' state if they're not actually installed or PHPStorm can't tell before Sync is clicked. Typically PHPStorm automatically scans things, such as composer.json and other files, so I figured upon creating a new runtime reference, it would also scan installed libraries as long as the PHP server was running. The Sync action took less than a second to finish, so I don't see how automatically running upon reference creation would be inhibitive.

> run php -m using a PHP Interpreter in question and share the output

% php -m
[PHP Modules]
bcmath
bz2
calendar
Core
ctype
curl
date
dom
exif
fileinfo
filter
ftp
gd
gettext
hash
iconv
imap
intl
json
ldap
libxml
mbstring
mysqli
mysqlnd
openssl
pcntl
pcre
PDO
pdo_mysql
pdo_pgsql
pdo_sqlite
pgsql
Phar
posix
readline
Reflection
session
SimpleXML
soap
sockets
sodium
SPL
sqlite3
standard
tokenizer
xml
xmlreader
xmlwriter
xsl
zip
zlib

[Zend Modules]

> show a screenshot of PECL & Other checkboxes group state after pressing "Sync with...". I saw only a part of "PECL" on your screenshot

It's the same as the screenshots I showed and the situations described; these sections are all unchecked no matter when I click Sync. They only ever had anything checked before I first clicked Sync, and that was the first time I'd ever clicked it in my usage of PHPStorm.

So I'll just chalk this up to my PHP server not having PECL/Other extensions installed, and PHPStorm just showed a list of default checked items, even though I'm not sure why it chose those nor if that's even a good idea to do, especially with not running a check beforehand.

0
Comment actions Permalink

Thanks for sharing the php -m output. Comparing it to your screenshots shows that PhpStorm correctly disabled checkboxes.

I've submitted https://youtrack.jetbrains.com/issue/WI-68684/Automatically-run-Sync-Extensions-with-Interpreter-after-adding-a-PHP-Interpreter based on this conversation. Feel free to add your thoughts and suggestions there as a comment.

1

Please sign in to leave a comment.