Empty string is treated as NULL #35

Closed
opened 2018-08-06 12:25:47 +02:00 by belliash · 4 comments
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 2018-08-06 12:25:47 +02:00
Author
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.
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 2018-08-06 15:57:38 +02:00
Owner

Let me check if I can fix this.

Let me check if I can fix this.
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 '')
Sign in to join this conversation.
No Milestone
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: aerscript/Aer#35
No description provided.