Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:60910 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 8341 invoked from network); 21 Jun 2012 03:39:42 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 21 Jun 2012 03:39:42 -0000 Authentication-Results: pb1.pair.com header.from=yader.hernandez@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=yader.hernandez@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.214.170 as permitted sender) X-PHP-List-Original-Sender: yader.hernandez@gmail.com X-Host-Fingerprint: 209.85.214.170 mail-ob0-f170.google.com Received: from [209.85.214.170] ([209.85.214.170:64234] helo=mail-ob0-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 05/E0-01913-D7792EF4 for ; Wed, 20 Jun 2012 23:39:41 -0400 Received: by obfk16 with SMTP id k16so372680obf.29 for ; Wed, 20 Jun 2012 20:39:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=yK43oiJTcqoSua2VT5XbLaaLFULdaBcP9QHf6i7CebA=; b=xMy8pLpSlwoQM26/WPrd/TIXpU2yX7dp4jfP71ASrQ6A6peGBrUDb3b0dpehJv2vzC 7WXlfS0Os/ro0MoJg8rD9iIR22fi5RXINKMMryr/L0tJAVSKG5ALUPIdQJqDU+9f7gEc bpKl1zhZgDrGSxD0UopvaO/K9gHWb5TIO0hKb5VAzaqGSDim1n1ZG55sDQ/VYkE9Idin AOcEzuEwWL7p0my/bTchff7mxjS1PhL029w9+gPfTJi4hQO3cgZTEEhxvfQYC+4YGJYZ 6y7qRveR7k5wW6BATfrLjUtFKPK6F6UHrTzHXx8cS8axRMsLN95Gq1PqgR7hH2JTQuQK ry2Q== MIME-Version: 1.0 Received: by 10.60.169.134 with SMTP id ae6mr943783oec.55.1340249978501; Wed, 20 Jun 2012 20:39:38 -0700 (PDT) Received: by 10.60.28.130 with HTTP; Wed, 20 Jun 2012 20:39:38 -0700 (PDT) Date: Wed, 20 Jun 2012 20:39:38 -0700 Message-ID: To: PHP Developers Mailing List Content-Type: multipart/alternative; boundary=bcaec550b36ce0fb7b04c2f34338 Subject: destroying an array and using a new one From: yader.hernandez@gmail.com (Yader Hernandez) --bcaec550b36ce0fb7b04c2f34338 Content-Type: text/plain; charset=ISO-8859-1 I'm trying to reverse an array but I keep getting bizarre results, such as seg faults 0x00000000006d0940 in gc_remove_from_buffer (zv=0x7fffffffb550) at /home/yaderbh/php-5.4.3/Zend/zend_gc.h:189 189 root->next->prev = root->prev; or I'll get "PHP Fatal error: Allowed memory size of" errors when trying to manipulate the array in a script. Basically what I'm doing is creating a pointer to zval, allocating and creating the zval into an array, traversing the existing array and calling add_index_zval. The position of the index is the current size and work my way down. hash_table = Z_ARRVAL_P(intern->elements); ALLOC_INIT_ZVAL(new_elements); array_init(new_elements); zend_hash_internal_pointer_reset_ex(hash_table, &pos); i = intern->size; while (zend_hash_get_current_data_ex(hash_table, (void **)¤t, &pos) == SUCCESS) { tmp = **current; zval_copy_ctor(&tmp); add_index_zval(new_elements, i, &tmp); i--; zend_hash_move_forward_ex(hash_table, &pos); } zval_ptr_dtor(&intern->elements); intern->elements = new_elements; Can anyone spot the problem? --bcaec550b36ce0fb7b04c2f34338--