Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:12096 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 23377 invoked by uid 1010); 11 Aug 2004 23:22:44 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 23351 invoked from network); 11 Aug 2004 23:22:43 -0000 Received: from unknown (HELO mra02.ex.eclipse.net.uk) (212.104.129.89) by pb1.pair.com with SMTP; 11 Aug 2004 23:22:43 -0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by mra02.ex.eclipse.net.uk (Postfix) with ESMTP id C7917406A67 for ; Thu, 12 Aug 2004 00:17:44 +0100 (BST) Received: from mra02.ex.eclipse.net.uk ([127.0.0.1]) by localhost (mra02.ex.eclipse.net.uk [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 19095-01-8 for ; Thu, 12 Aug 2004 00:17:44 +0100 (BST) Received: from mooby (unknown [213.152.58.41]) by mra02.ex.eclipse.net.uk (Postfix) with ESMTP id C2932406AAB for ; Thu, 12 Aug 2004 00:17:43 +0100 (BST) To: Date: Thu, 12 Aug 2004 00:22:41 +0100 MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_NextPart_000_0000_01C48002.7B45ABF0" X-Mailer: Microsoft Office Outlook, Build 11.0.5510 Thread-Index: AcR/+hjpE2WvHd/ATNyOxM7K5jDtug== X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441 Message-ID: <20040811231743.C2932406AAB@mra02.ex.eclipse.net.uk> X-Virus-Scanned: by Eclipse VIRUSshield at eclipse.net.uk Subject: PHP_EOL exposed to scripts? From: webjedi@hudzilla.eclipse.co.uk ("Paul Hudson") ------=_NextPart_000_0000_01C48002.7B45ABF0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Hi there, This may already have been considered in the past, but I was wondering whether the PHP_EOL constant available inside the PHP source code could be made available to PHP programmers in their scripts? The current solution is, of course, to check PHP_OS each time and set the constant by hand, but it would be nicer to have it pre-defined. The cons are: 1) will break scripts that define their own PHP_EOL; and 2) people might use it without realising it changes across platforms (duh?), and rely on it to always be \n (or \r\n, etc); 3) Other cons? Anyway, the patch is predictably easy: add this line in main.c, after the definition for PHP_SHLIB_SUFFIX: REGISTER_MAIN_STRINGL_CONSTANT("PHP_EOL", PHP_EOL, sizeof(PHP_EOL)-1, CONST_PERSISTENT | CONST_CS); I've attached a diff, such as it is. Thanks, Paul ------=_NextPart_000_0000_01C48002.7B45ABF0 Content-Type: text/plain; name="php_eol.diff.txt" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="php_eol.diff.txt" --- php5-200408112030/main/main.c 2004-07-25 04:30:49.000000000 -0400=0A= +++ php5-200408112030-new/main/main.c 2004-08-11 23:25:34.000000000 -0400=0A= @@ -1430,6 +1430,7 @@=0A= REGISTER_MAIN_STRINGL_CONSTANT("PHP_CONFIG_FILE_PATH", = PHP_CONFIG_FILE_PATH, sizeof(PHP_CONFIG_FILE_PATH)-1, CONST_PERSISTENT | = CONST_CS);=0A= REGISTER_MAIN_STRINGL_CONSTANT("PHP_CONFIG_FILE_SCAN_DIR", = PHP_CONFIG_FILE_SCAN_DIR, sizeof(PHP_CONFIG_FILE_SCAN_DIR)-1, = CONST_PERSISTENT | CONST_CS);=0A= REGISTER_MAIN_STRINGL_CONSTANT("PHP_SHLIB_SUFFIX", PHP_SHLIB_SUFFIX, = sizeof(PHP_SHLIB_SUFFIX)-1, CONST_PERSISTENT | CONST_CS);=0A= + REGISTER_MAIN_STRINGL_CONSTANT("PHP_EOL", PHP_EOL, sizeof(PHP_EOL)-1, = CONST_PERSISTENT | CONST_CS);=0A= php_output_register_constants(TSRMLS_C);=0A= php_rfc1867_register_constants(TSRMLS_C);=0A= =0A= ------=_NextPart_000_0000_01C48002.7B45ABF0--