php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #18465 strange warning
Submitted: 2002-07-22 02:50 UTC Modified: 2002-07-22 21:38 UTC
From: horny at mail dot az Assigned:
Status: Not a bug Package: *General Issues
PHP Version: 4.2.1 OS: Windows XP
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: horny at mail dot az
New email:
PHP Version: OS:

 

 [2002-07-22 02:50 UTC] horny at mail dot az
Hi there, here's a compileable snippet that reproduces the problem:

<?php
	ini_set('error_reporting', E_ALL);

	$AVAILABLE_LANGS = array('az' => _('az'), 'ru' => _('ru'), 'en' => _('en')); # as per RFC 1766
	define('DEFAULT_LANG', 'ru'); # index into the above array
	$MSG = array(
		"ru" => array(
			"az" => "Azeri",
			"ru" => "Russian",
			"en" => "English",
		),
	);

	function _($str)
	{
		if (isset($GLOBALS["MSG"][DEFAULT_LANG][$str]))
			return $GLOBALS["MSG"][DEFAULT_LANG][$str];
		return $str;
	}

?>

D:\>c:\php\php-cli haha.php

Notice: Use of undefined constant DEFAULT_LANG - assumed 'DEFAULT_LANG' in haha.php on line 16

Notice: Use of undefined constant DEFAULT_LANG - assumed 'DEFAULT_LANG' in haha.php on line 16

Notice: Use of undefined constant DEFAULT_LANG - assumed 'DEFAULT_LANG' in haha.php on line 16

If I don't call _() above, as in _('az'), it all goes well.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-07-22 21:38 UTC] sniper@php.net
Sorry, but the bug system is not the appropriate forum for asking
support questions. Your problem does not imply a bug in PHP itself.
For a list of more appropriate places to ask for help using PHP,
please visit http://www.php.net/support.php

Thank you for your interest in PHP.

Hint: Try defining the constant before you use the function where it's used..

 
PHP Copyright © 2001-2026 The PHP Group
All rights reserved.
Last updated: Thu Oct 08 03:00:02 2026 UTC