phan / phan/phan

Check for runtime short_open_tags setting when running InvokePHPNativeSyntaxCheckPlugin

Open
#2,949 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
PHP
Stars
5.6k
Forks
365
Avg merge
1h 25m
Merged PRs (30d)
6

Description

The output of token_get_all can be used to determine the setting's value.

Unless you're building php from source and didn't turn it off, it's probably disabled.

Set -d short_open_tags=0 if the token type was T_INLINE_HTML

~ » php --no-php-ini -a -d short_open_tags=0
Interactive shell

php > var_export(token_get_all('<?phpinvalid'));
array (
  0 => 
  array (
    0 => 379,
    1 => '<?',
    2 => 1,
  ),
  1 => 
  array (
    0 => 319,
    1 => 'phpinvalid',
    2 => 1,
  ),
)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at InvokePHPNativeSyntaxCheckPlugin and run the provided token_get_all example to observe how short_open_tags changes tokenization. Update the plugin's runtime invocation to account for T_INLINE_HTML, then verify that native syntax checking handles the demonstrated setting correctly.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.