ftp_get_option.phpt 735 B

1234567891011121314151617181920212223242526272829303132
  1. --TEST--
  2. Testing ftp_get_option basic functionality
  3. --CREDITS--
  4. Gabriel Caruso (carusogabriel34@gmail.com)
  5. --EXTENSIONS--
  6. ftp
  7. pcntl
  8. --FILE--
  9. <?php
  10. require 'server.inc';
  11. define('FOO_BAR', 10);
  12. $ftp = ftp_connect('127.0.0.1', $port);
  13. ftp_login($ftp, 'user', 'pass');
  14. $ftp or die("Couldn't connect to the server");
  15. var_dump(ftp_get_option($ftp, FTP_TIMEOUT_SEC));
  16. var_dump(ftp_get_option($ftp, FTP_AUTOSEEK));
  17. var_dump(ftp_get_option($ftp, FTP_USEPASVADDRESS));
  18. try {
  19. ftp_get_option($ftp, FOO_BAR);
  20. } catch (ValueError $exception) {
  21. echo $exception->getMessage() . "\n";
  22. }
  23. ?>
  24. --EXPECTF--
  25. int(%d)
  26. bool(true)
  27. bool(true)
  28. ftp_get_option(): Argument #2 ($option) must be one of FTP_TIMEOUT_SEC, FTP_AUTOSEEK, or FTP_USEPASVADDRESS