Does a fopen with 'b' mode suppress magic_quotes_runtime ?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • flconseil@yahoo.fr

    Does a fopen with 'b' mode suppress magic_quotes_runtime ?

    Hello,

    The PHP documentation contains a user note which says that opening a
    file in binary mode ('b' flag) replaces the need to set
    magic_quotes_ru ntime to off before every read and writes.

    As it seems not to correspond to the rest of the documentation (I
    thought that the 'b' mode was used only for Windows end of lines), can
    somebody please tell me if it is right or wrong ?

    I am developping a library which needs to read binary data from files
    and, as I have to deal with a possible setting of magic_quotes_ru ntime
    to on, it would make it much simpler if it could be specified at
    fopen() time.

    Thanks in advance

    François

  • Henrik Hansen

    #2
    Re: Does a fopen with 'b' mode suppress magic_quotes_ru ntime ?

    "flconseil@yaho o.fr" <flconseil@yaho o.fr> writes:
    [color=blue]
    > Hello,
    >
    > The PHP documentation contains a user note which says that opening a
    > file in binary mode ('b' flag) replaces the need to set
    > magic_quotes_ru ntime to off before every read and writes.
    >
    > As it seems not to correspond to the rest of the documentation (I
    > thought that the 'b' mode was used only for Windows end of lines), can
    > somebody please tell me if it is right or wrong ?
    >
    > I am developping a library which needs to read binary data from files
    > and, as I have to deal with a possible setting of magic_quotes_ru ntime
    > to on, it would make it much simpler if it could be specified at
    > fopen() time.[/color]

    b is for binary. When you open for example an image you should put b on.

    From the manual:
    If you do not specify the 'b' flag when working with binary files, you
    may experience strange problems with your data, including broken image
    files and strange problems with \r\n characters.

    As far as I know it has nothing to do with magic_quotes_ru ntime

    --
    Henrik Hansen

    Comment

    • Chung Leong

      #3
      Re: Does a fopen with 'b' mode suppress magic_quotes_ru ntime ?


      flconseil@yahoo .fr wrote:[color=blue]
      > Hello,
      >
      > The PHP documentation contains a user note which says that opening a
      > file in binary mode ('b' flag) replaces the need to set
      > magic_quotes_ru ntime to off before every read and writes.
      >
      > As it seems not to correspond to the rest of the documentation (I
      > thought that the 'b' mode was used only for Windows end of lines), can
      > somebody please tell me if it is right or wrong ?
      >
      > I am developping a library which needs to read binary data from files
      > and, as I have to deal with a possible setting of magic_quotes_ru ntime
      > to on, it would make it much simpler if it could be specified at
      > fopen() time.
      >
      > Thanks in advance
      >
      > François[/color]

      Opening a file with 'b' does not suppress magic_quotes_ru ntime. If it
      is turned on, then file(), fread(), file_get_conten ts(), and others
      will add slashes to their results.

      Do people really use magic_quotes_ru ntime?

      Comment

      • flconseil@yahoo.fr

        #4
        Re: Does a fopen with 'b' mode suppress magic_quotes_ru ntime ?

        OK. Thank you. I just had a doubt because of this strange comment from
        'tilman DOT schroeder AT gmx DOT de' on
        http://www.php.net/manual/en/functio...es-runtime.php.

        I don't know if people use this f... option, but if I want to be able
        to run everywhere before PHP 6 suppresses this option, I must take it
        into account. And, if I want to be compatible with PHP 6, I must check
        the PHP version before calling set_magic_quote s_runtime().

        Comment

        Working...