php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #58079 Error in getMetadata()
Submitted: 2008-03-03 17:53 UTC Modified: 2009-02-15 01:11 UTC
From: mmacia at gmail dot com Assigned:
Status: No Feedback Package: phar (PECL)
PHP Version: 5.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 this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: mmacia at gmail dot com
New email:
PHP Version: OS:

 

 [2008-03-03 17:53 UTC] mmacia at gmail dot com
Description:
------------
I have a Phar file with the given stub code. This code is 
accessed by an ajax script several times per minute.

Sometimes (randomly) the method getMetadata() returns null 
instead the stored metadata. I think that it's a kind of 
race condition because if I append a usleep(50) before 
execute the getMetaData() method, works.


Reproduce code:
---------------
<?php
try
{
	$__phar = new Phar(__FILE__);
	$m = $__phar->getMetaData();
	require 'phar://' . __FILE__ . '/' . $m['bootstrap'];
}
catch ( PharException $e )
{
	echo $e->getMessage();
	die('Fatal error while initializing package ' . basename(__FILE__));
}
__HALT_COMPILER();


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-03-22 18:17 UTC] greg at chiaraquartet dot net
can you give me information on the sapi you are running your web server as, and might I also suggest you hardcode the bootstrap unless it is changing from run to run?  This will result in a much more efficient run.

The metadata should be used to store data that is not easy to access.  Executable file paths tend to be relatively static, I use metadata to store the name of package.xml in PEAR 2.0 packages, because the name changes for each package release, and is accessed externally, not within the phar itself.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon May 06 09:01:30 2024 UTC