Last active
August 29, 2015 14:28
-
-
Save AshleyPinner/f0b7cc8dc1d76585c56d to your computer and use it in GitHub Desktop.
The fun of cygwin and /dev/urandom (See comments, possibly MinGW related)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
var_dump(is_readable('/dev/urandom')); | |
var_dump(passthru('head /dev/urandom')); | |
var_dump(PHP_OS); | |
?> | |
Sample output: | |
bool(false) | |
�����[ | |
��-6<@������������@�L��_�����Ȏ�� | |
NGצ�L���e��<�^=�f`?�bO\���yڽ=��n)p�:���Яب0p��|��h��K�Mr#��Iw���&�����##�xVHtԷ�m�� | |
A��-�x����������E��yM~K8�ů(S�� | |
cF���}O� | |
bH�ֹ�0��������;Ȍ'�u��8���ph*��nF�Z�FOX�Z��O8ڔt���%3Bz=RӨxl�U��5|�#�!j����A�S�>-~/�I��.(b~ r��Ð�/�榄�*�Ӑ ����^�Ý������moIք�X�-�( | |
K� �J��ji0�kT�,���^�u���p�+ 'ڰ��v�]Cw���%jI�I�^�Ң��&��g��-D0��փ`AE_EcQJ�C�~>��4Qh7#����A�ཹ�2g��/8/)=�;/�3W��P�H���*���*TB�Xm,w�*d��٨�������+��Фy����6;�k��.9f�4� �V@`"��o���s��z�z�e���?)�(&�F��Iֲ��M�?���X��{!���ږӝ{�F��T���SP�*+t� ��f2g^� | |
~�8�p���� �X4:�]Tċ�Ï�?ݜ��G��$��Sxh�!ku�a����Զ��W~����K�� ����;����D��i�N�݊�����������V�C��_��� | |
0���q���?c[�|�'U��c�:�}՞ | |
'.�{<�*���%Uثp��'��4Fs %��*�*�[4��v@���QWV�3�\��Z NtDn)k� �1�����P� | |
NULL | |
string(5) "WINNT" |
Can you reliably detect cygwin?
@ircmaxell This seems to be an artefact of MinGW. Cygwin might be detectable in various ENV or in the uname, but MinGW is very silent at the existence.
Either way, these both stem into the Windows Cryptographic API, so calling that would be preferable.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
A terrible function to use this: