chobie / php-uv

libuv php extension
184 stars 21 forks source link

uv_fs_stat seems to segfault when given non-existing file #34

Closed csaoh closed 11 years ago

csaoh commented 11 years ago

This is my code:

uv_fs_stat($loop, $filename, function ($result, $stat) use ($deferred, $loop) {
   var_dump($result);
   var_dump($stat);
}

here is the output:

int(0)
array(13) {
  'dev' =>
  int(16777218)
  'ino' =>
  int(6367243)
  'mode' =>
  int(33188)
  'nlink' =>
  int(1)
  'uid' =>
  int(501)
  'gid' =>
  int(20)
  'rdev' =>
  int(0)
  'size' =>
  int(4)
  'blksize' =>
  int(4096)
  'blocks' =>
  int(8)
  'atime' =>
  int(1360691724)
  'mtime' =>
  int(1360691724)
  'ctime' =>
  int(1360691724)
}

If i try the same with a file that doesn't exist, here is my output:

Segmentation fault: 11
chobie commented 11 years ago

maybe i forget file checking or something. I'll take a look into this later.

csaoh commented 11 years ago

Still have the issue, actually :/

chobie commented 11 years ago

@csaoh can you explain how to reproduce this issue?

<?php
$loop = uv_default_loop();
$filename ="does_not_exist.txt";
uv_fs_stat($loop, $filename, function ($result, $stat) {
   var_dump($result);
   var_dump($stat);
});

i checked this issue with above code and 105841efb6bac17acf783047a807dc0fff190768. but it can't reproduce.

csaoh commented 11 years ago

I just did run

<?php
$loop = uv_default_loop();
$filename ="does_not_exist.txt";
uv_fs_stat($loop, $filename, function ($result, $stat) {
   var_dump($result);
   var_dump($stat);
});
uv_run();

and got

Segmentation fault: 11

I'm on MAC OS X, will try on ubuntu 32 and 64 bit right now.

csaoh commented 11 years ago

On a Ubuntu x32 VM I get

Segmentation fault (core dumped)
chobie commented 11 years ago

okay, let me setup ubuntu box and check it soon.

csaoh commented 11 years ago

nice !