There is a notice

Use of undefined constant Ymd - assumed 'Ymd'.

The line with the error says date( Ymd, $row['date'] ) .

I don’t understand how it worked before, if date( 'Ymd', $row['date'] ); correct date( 'Ymd', $row['date'] );

The problem appeared after rebuilding php 5.2 (I did not reassemble).

Here is the question, how did the date (Ymd, $ row ['date']) work, what makes it correct? The following is written to phpinfo about date:

 date/time support enabled "Olson" Timezone Database Version 2012.3 Timezone Database internal Default timezone Europe/Helsinki Directive Local Value Master Value date.default_latitude 31.7667 31.7667 date.default_longitude 35.2333 35.2333 date.sunrise_zenith 90.583333 90.583333 date.sunset_zenith 90.583333 90.583333 

    2 answers 2

    Use of undefined constant Ymd - assumed 'Ymd'.

    translated from aglitsky as "Using the undefined constant Ymd, it is assumed that this is the string 'Ymd'."

    That is, if it does not find such a constant, it assigns to it a value equal to its name.

    Be careful with class constants, such a trick will not work.

    • Yes, that's right, the interpreter believes that the expression Ymd is a constant, since it is not quoted. But this constant is not, and never was and was not intended. Instead, there should be a date format 'Ymd'. - Coolmac
    • then I see no problem. Take in quotes or turn off the display of notes. - knes
    • The problem is that on the server 100+ sites, and earlier it somehow worked without quotes. Maybe there is some addition to the assembly of php? - Coolmac

    It's not about the build, but about setting up php.ini

    I just tried to derive from PHP 5.2:

      echo date(Ymd); 

    Normally 20130806 date: 20130806 . But on my computer, php.ini is configured so that it eats up almost all the errors that occur with the absence of variables, and it works without crashing.