#35 Empty string is treated as NULL

Closed
opened 2 years ago by belliash · 4 comments
belliash commented 2 years ago
Owner

AerScript Information

  • Aer Version (or commit ref): dd239530d8
  • Operating System: Linux
  • System Architecture (eg. arm, x86_64, ...): x86_64

Your problem description

Empty string or string containing special characters like "\n" is treated by PH7 Engine as NULL instead of zero-length string. Quick example:

var_dump('');

Expected results

string(0, '');

Current results

null
<!-- 1. Please speak English, this is the language all of us can speak and write. 2. Please take a moment to check that your issue doesn't already exist. 3. Please give all relevant information below for bug reports, because incomplete details will be handled as an invalid report. --> # AerScript Information - Aer Version (or commit ref): dd239530d8 - Operating System: Linux - System Architecture (eg. arm, x86_64, ...): x86_64 # Your problem description Empty string or string containing special characters like "\n" is treated by PH7 Engine as NULL instead of zero-length string. Quick example: var_dump(''); # Expected results string(0, ''); # Current results null
belliash added the
bug
label 2 years ago
belliash commented 2 years ago
Poster
Owner
$x = '';
var_dump(is_string($x));

The above example also fails. It shows:

bool(FALSE)

instead of:

bool(TRUE)

I suppose, there is a problem with PH7_OP_STORE instruction.

$x = ''; var_dump(is_string($x)); The above example also fails. It shows: bool(FALSE) instead of: bool(TRUE) I suppose, there is a problem with PH7_OP_STORE instruction.
likoski commented 2 years ago
Owner

I think it takes the value as it comes from the compiler. From what I checked, it forces type to NULL if string is empty. Seems easy to fix.

I think it takes the value as it comes from the compiler. From what I checked, it forces type to NULL if string is empty. Seems easy to fix.
likoski self-assigned this 2 years ago
likoski commented 2 years ago
Owner

Let me check if I can fix this.

Let me check if I can fix this.
likoski commented 2 years ago
Owner
$str1 = "This is just a test";
$str2 = "";
$str3 = 'Another test';
$str4 = '';
var_dump($str1);
var_dump($str2);
var_dump($str3);
var_dump($str4);

produces

string(19 'This is just a test')
string(0 '')
string(12 'Another test')
string(0 '')
$str1 = "This is just a test"; $str2 = ""; $str3 = 'Another test'; $str4 = ''; var_dump($str1); var_dump($str2); var_dump($str3); var_dump($str4); produces string(19 'This is just a test') string(0 '') string(12 'Another test') string(0 '')
likoski closed this issue 2 years ago
Sign in to join this conversation.
No Milestone
No Assignees
2 Participants
Notifications
Due Date

No due date set.

Dependencies

This issue currently doesn't have any dependencies.

Loading…
There is no content yet.