Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:53014 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 30977 invoked from network); 6 Jun 2011 11:48:22 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 6 Jun 2011 11:48:22 -0000 Authentication-Results: pb1.pair.com smtp.mail=rquadling@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=rquadling@gmail.com; sender-id=pass; domainkeys=bad Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.216.42 as permitted sender) DomainKey-Status: bad X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: rquadling@gmail.com X-Host-Fingerprint: 209.85.216.42 mail-qw0-f42.google.com Received: from [209.85.216.42] ([209.85.216.42:60006] helo=mail-qw0-f42.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 92/22-17923-58EBCED4 for ; Mon, 06 Jun 2011 07:48:21 -0400 Received: by qwi4 with SMTP id 4so1859334qwi.29 for ; Mon, 06 Jun 2011 04:48:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:reply-to:from:date:message-id :subject:to:content-type; bh=FKsj+cfkBffe3pQAAVGn3Nt2/mBrzML3XnKlVZ1vC/4=; b=hKzSCcpcpV48saEg3/LeGukwfKfoppR9Y0k7jyPPoC5vv5acuQlk9xRVae35q7l5UD ii2+886vaT13FjYgRJJaLbqqwKigaoKqMANSCrr0bMSu0phshTU44CfaVl/Fex0czk62 7NwXu6Q5O+OcUIjf6OKmoGMZnLqqNuuNAyl7Q= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:reply-to:from:date:message-id:subject:to:content-type; b=cEDdVDpSXoseFI81dPnarHGBGD6+Yce1cgAsgkTutlPW1Vqani7j/Prfs30xawJppu i37zqUe00ZmGxXwRJ9vvROUe/N+DbK0Tu6r9TYRIZryJD8Pooc3A7fyVF71n+Y1Mx03c sp2MtAj8Uwiwa2Fi6evhezgQ+pVucNqLuJPa0= Received: by 10.224.176.12 with SMTP id bc12mr1645754qab.61.1307360899140; Mon, 06 Jun 2011 04:48:19 -0700 (PDT) MIME-Version: 1.0 Received: by 10.229.80.79 with HTTP; Mon, 6 Jun 2011 04:47:59 -0700 (PDT) Reply-To: RQuadling@GMail.com Date: Mon, 6 Jun 2011 12:47:59 +0100 Message-ID: To: PHP internals Content-Type: text/plain; charset=UTF-8 Subject: Getting integer value for ini entries that support shorthanded sizing. From: rquadling@gmail.com (Richard Quadling) Hi. Is there a mechanism to get the memory_limit value rather than the string when it is set with the K, M or G shorthands. I can see that ... PHP_INI_ENTRY("memory_limit", "128M", PHP_INI_ALL, OnChangeMemoryLimit) ... static PHP_INI_MH(OnChangeMemoryLimit) { if (new_value) { PG(memory_limit) = zend_atol(new_value, new_value_length); } else { PG(memory_limit) = 1<<30; /* effectively, no limit */ } return zend_set_memory_limit(PG(memory_limit)); } calls zend_atol - which does the translation. The value is applied to the PHP Global structure, but the value retrieved and stored in the ini_entries array from the ini file (the string "1G" for example) is not overwritten. Would it be worthwhile amending the INI macros so that zend_atol and zend_atoi (and others if appropriate) where called earlier in the sequence of events. That way, ini_get('memory_limit') would return the memory limit in bytes, rather than the shorthand. Richard -- Richard Quadling Twitter : EE : Zend : PHPDoc @RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY : bit.ly/lFnVea