php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #63669 Cannot declare self-referencing constant
Submitted: 2012-12-02 10:47 UTC Modified: 2013-02-18 00:36 UTC
Votes:3
Avg. Score:4.0 ± 0.8
Reproduced:3 of 3 (100.0%)
Same Version:0 (0.0%)
Same OS:1 (33.3%)
From: semnanweb at gmail dot com Assigned:
Status: No Feedback Package: APC (PECL)
PHP Version: 5.4.9 OS: Debian 6
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: semnanweb at gmail dot com
New email:
PHP Version: OS:

 

 [2012-12-02 10:47 UTC] semnanweb at gmail dot com
Description:
------------
I have an error during send request to my apache server and get an Aborted response. What's the problem? 
After restart apache code works well but some times stop the process and give Aborted response again and I must restart apache then.

[Tue Nov 06 08:19:46 2012] [error] [client 37.63.173.114] PHP Fatal error: Cannot declare self-referencing constant '(null)' in /home/sweb/project/library/Zend/File/Transfer/Adapter/Abstract.php on line 339, referer: http://sweb.net/uploader/

Test script:
---------------
http://framework.zend.com/svn/framework/standard/trunk/library/Zend/File/Transfer/Adapter/Abstract.php


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2012-12-03 09:08 UTC] laruence@php.net
could you please give us a self-embedding test script?

that will be appreciated , thanks
 [2012-12-04 00:53 UTC] mail+php at requinix dot net
See also bug #45910 (which I can't repro on 5.3.10).

The error message refers to a line in Abstract.php with
  $validator = new $name($options);
$name is probably for a Zend_Validate_* class but there are way too many of those 
to look through for potential weirdness with class constants. Heck, I'm not even 
that sure what I'd be looking for.
 [2012-12-12 08:25 UTC] ab@php.net
Hi,

you've mentioned the bug #45910, but the Felipes snippet from there produces no 
errors:

class foo {
	const AAA = 'x';
	const BBB = 'a';
	const CCC = 'a';
	const DDD = self::AAA;

	private static $foo = array(
		self::BBB	=> 'a',
		self::CCC	=> 'b',
		self::DDD	=>  self::AAA
	);
	
	public static function test() {
		self::$foo;
	}
}

foo::test();

Still no luck with extracting some repro code?
 [2012-12-12 08:25 UTC] ab@php.net
-Status: Open +Status: Feedback
 [2012-12-12 09:13 UTC] ab@php.net
Automatic comment from SVN on behalf of ab
Revision: http://svn.php.net/viewvc/?view=revision&revision=328744
Log: Added test for bug #63669 based on Felipes snippet from #45910
 [2013-02-18 00:36 UTC] pecl-dev at lists dot php dot net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Open". Thank you.
 [2013-02-26 19:26 UTC] j_schumann at gmx dot de
I have the same problem as the opener, Apache sometimes dies with a segfault.
Debugging gave me the same error file/line, but I could reduce the number of possible sources: It only happens for me on instantiation of Zend_Validate_File_Count (http://framework.zend.com/svn/framework/standard/trunk/library/Zend/Validate/File/Count.php).

I can not provide a reproduction script as this does not happen always, so maybe it is instead an APC problem.

Environment:
PHP 5.4.11
APC 3.1.13 
Apache 2.2.14
Ubuntu 10.04.4 LTS

I can provide a backtrace from the coredump:

#0  0x00007fab657aec05 in ?? () from /lib/x86_64-linux-gnu/libc.so.6
#1  0x00007fab6113c4e4 in xbuf_format_converter (xbuf=0x7fff625433b0, fmt=0x1 <Address 0x1 out of bounds>, ap=0x7fff62542b20)
    at /build/buildd/php5-5.4.11/main/spprintf.c:576
#2  0x00007fab6113d214 in vspprintf (pbuf=0x7fff62543450, max_len=1024, format=0xffffffffffbd1ad6 <Address 0xffffffffffbd1ad6 out of bounds>, ap=0x18)
    at /build/buildd/php5-5.4.11/main/spprintf.c:799
#3  0x00007fab611367a8 in php_error_cb (type=1,
    error_filename=0x7fab56404f80 "/var/www/application/library/Zend/File/Transfer/Adapter/Abstract.php", error_lineno=339,
    format=0x18 <Address 0x18 out of bounds>, args=0x7fff625436c8) at /build/buildd/php5-5.4.11/main/main.c:944
#4  0x00007fab61054710 in soap_error_handler (error_num=1447055232, error_filename=0x20 <Address 0x20 out of bounds>, error_lineno=32683,
    format=0x7fff62543be8 "\020", args=0x7fff62543de0) at /build/buildd/php5-5.4.11/ext/soap/soap.c:2171
#5  0x00007fab611993ec in zend_error (type=1, format=0x7fab6157c5b0 "Cannot declare self-referencing constant '%s'")
    at /build/buildd/php5-5.4.11/Zend/zend.c:1118
#6  0x00007fab6118a896 in zval_update_constant_ex (pp=0x7fab67731270, arg=0xffffffffffbd1ad6, scope=0x0)
    at /build/buildd/php5-5.4.11/Zend/zend_execute_API.c:502
#7  0x00007fab611a6d6a in zend_hash_apply_with_argument (ht=0x7fab67730b40, apply_func=0x7fab6118ad10 <zval_update_constant_inline_change>, argument=0x0)
    at /build/buildd/php5-5.4.11/Zend/zend_hash.c:740
#8  0x00007fab6118a732 in zval_update_constant_ex (pp=0x7fab67732918, arg=0xffffffffffbd1ad6, scope=0x0)
    at /build/buildd/php5-5.4.11/Zend/zend_execute_API.c:683
#9  0x00007fab6119bd8a in zend_update_class_constants (class_type=0x7fab67730f20) at /build/buildd/php5-5.4.11/Zend/zend_API.c:1037
#10 0x00007fab6119c02d in _object_and_properties_init (arg=0x7fab67730910, class_type=0x7fab67730f20, properties=0x0)
    at /build/buildd/php5-5.4.11/Zend/zend_API.c:1124
#11 0x00007fab611ff7d9 in ZEND_NEW_SPEC_HANDLER (execute_data=0x7fab6697a480) at /build/buildd/php5-5.4.11/Zend/zend_vm_execute.h:813
#12 0x00007fab611fa49f in execute (op_array=0x7fab67734dc8) at /build/buildd/php5-5.4.11/Zend/zend_vm_execute.h:410
#13 0x00007fab6119a208 in zend_execute_scripts (type=1178393146, retval=0x3, file_count=2049551044) at /build/buildd/php5-5.4.11/Zend/zend.c:1315
#14 0x00007fab611397e3 in php_execute_script (primary_file=0x0) at /build/buildd/php5-5.4.11/main/main.c:2492
#15 0x00007fab6124293d in php_handler (r=0x7fab6124293d) at /build/buildd/php5-5.4.11/sapi/apache2handler/sapi_apache2.c:682
#16 0x00007fab66527508 in ap_run_handler ()
#17 0x00007fab6652797e in ap_invoke_handler ()
#18 0x00007fab66536bdc in ap_internal_redirect ()
#19 0x00007fab5f45d5e5 in ?? () from /usr/lib/apache2/modules/mod_rewrite.so
#20 0x00007fab66527508 in ap_run_handler ()
#21 0x00007fab6652797e in ap_invoke_handler ()
#22 0x00007fab66537570 in ap_process_request ()
#23 0x00007fab66534398 in ?? ()
#24 0x00007fab6652dfa8 in ap_run_process_connection ()
#25 0x00007fab6653c1d0 in ?? ()
#26 0x00007fab6653c93a in ?? ()
#27 0x00007fab6653d4e7 in ap_mpm_run ()
#28 0x00007fab665124a4 in main ()

For my amateur view it looks like zend_error is called without the constant name which causes the segfault instead of an E_ERROR being thrown.
 
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Sun Dec 05 05:03:37 2021 UTC