You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@netbeans.apache.org by GitBox <gi...@apache.org> on 2022/10/14 08:16:14 UTC
[GitHub] [netbeans] mytskine opened a new issue, #4789: PHP : detection of SQL strings fails when using heredoc
mytskine opened a new issue, #4789:
URL: https://github.com/apache/netbeans/issues/4789
### Apache NetBeans version
Apache NetBeans 15
### What happened
Netbeans fails to detect SQL strings that are written using PHP's heredoc syntax.
Netbeans tries to guess if a PHP string is a SQL query, so that completion within the string can use the database connection. This works for plain string, with single or double quotes. It also works for nowdoc strings, i.e. using delimiters like `<<<'EOSQL'\n ...\nEOSQL`. But I've never seen it work with heredoc strings, i.e. using delimiters like `<<<"EOSQL" ... EOSQL` or just `<<<EOSQL ... EOSQL`.
This bug was not introduced recently, because I've using this feature since at least Netbeans 12, on several computers.
I looked at the code in `SQLStatement.java`, but it handles nowdoc and heredoc in the exact same way, so the problem is not there, and I'm not proficient enough with Java to fix it by myself.
### How to reproduce
In a PHP project with a DB connection defined, create a new file containing:
```php
<?php
// completion OK
$q = <<<'EOSQL'
select * from [caret is here]
EOSQL;
```
The completion (ctrl-space) works.
Now remove the single quotes. The string is unchanged, but Netbeans' behaviour is changed.
```php
<?php
// completion broken
$q = <<<EOSQL
select * from [caret is here]
EOSQL;
```
The completion (ctrl-space) should work, but it does not.
Same probem with:
```php
<?php
// completion broken
$q = <<<"EOSQL"
select * from [caret is here]
EOSQL;
```
### Did this work correctly in an earlier version?
No / Don't know
### Operating System
Linux Debian
### JDK
Oracle JRE 8, then Debian OpenJDK 8, then Debian OpenJDK 11
### Apache NetBeans packaging
Apache NetBeans provided installer
### Anything else
_No response_
### Are you willing to submit a pull request?
No
### Code of Conduct
Yes
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists