question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Discuss: (PHP) built-ins are currently purposely not highlighted.

See original GitHub issue

Describe the issue

When PHP is put into the pre and code tags, everything renders correctly except certain functions. They are missing <span class="hljs-keyword">and just left as regular text while other functions get the <span>.

Which language seems to have the issue?

Seems to be PHP but maybe other languages also that need the class=“hljs-keyword”.

Are you using highlight or highlightAuto?

I’ve tried both and both are giving me the same exact problem.

Sample Code to Reproduce

https://jsfiddle.net/b2dj79qh/

Expected behavior

You should see “json_decode” & “file_get_contents” functions white as the other function “isset” is syntaxed.

Additional context

I’m pretty sure they are all considered the same (isset, file_get_contents, json_decode, etc…), so I feel like they should all be the same color no?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:14 (14 by maintainers)

github_iconTop GitHub Comments

1reaction
joshgoebelcommented, Feb 14, 2021

Closing this original issue as #wontfix, expected behavior in agreement with @Ayesh:

I don’t think highlighting built-in functions at the cost of storing this many functions is worth it.

We only highlight reserved words - not ALL built-ins (which is a huge list), though there is already separate discussion to highlight all function dispatch as part of the #2500 initiative.

0reactions
joshgoebelcommented, Feb 14, 2021

Remove built-in interfaces and other class names. Except for Throwable and perhaps ArrayAccess, the other ones are quite niche ones, and there are more to come. It will only add maintenance burden with very little gain. This reduces the php.js file by ~1.5KB pre-gzip.

@Ayesh I’d say if you want to do this along with the other work you’re doing on PHP lately this would be a small improvement. We may want to move the few remaining to a _ attribute inside keywords (since we don’t have a nice way to say “keywords, but do not highlight”) vs built_in so that NO interfaces are highlighted (rather than just randomly highlighting the few we include) for now.

Read more comments on GitHub >

github_iconTop Results From Across the Web

PHP built in functions/classes etc. are not recognized
I just tried "is_numeric" function on a simple example in PhpStorm and no warnings are shown. Moreover, autocomplete is working for it. 0....
Read more >
Function and Method listing - Manual
... Returns a sequence of the map's values; Ds\Map::xor - Creates a new map using keys of either the current instance or of...
Read more >
How To Use Functions in PHP
You'll use built-in functions to perform common programming tasks ... This simple example is not a good use of a function because there...
Read more >
Collection methods don't work with built-in PHP functions
Database Driver & Version: Description: Built-in PHP functions can't be used with Collection methods. Steps To Reproduce: In PHP there are a ...
Read more >
PHP | Functions
Built-in functions : PHP provides us with huge collection of built-in library functions. These functions are already coded and stored in ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found