[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/NEWS branches/PHP_5_3/ext/xmlrpc/tests/bug61264.phpt branches/PHP_5_3/ext/xmlrpc/xmlrpc-epi-php.c branches/PHP_5_4/NEWS branches/PHP_5_4/ext/xmlrpc/tests/

2012-03-03 Thread Nikita Popov
nikicSat, 03 Mar 2012 12:46:17 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=323850

Log:
Fix bug #61264: xmlrpc_parse_method_descriptions leaks temporary variable

Bug: https://bugs.php.net/61264 (Open) xmlrpc_parse_method_descriptions leaks 
temporary variable
  
Changed paths:
U   php/php-src/branches/PHP_5_3/NEWS
A   php/php-src/branches/PHP_5_3/ext/xmlrpc/tests/bug61264.phpt
U   php/php-src/branches/PHP_5_3/ext/xmlrpc/xmlrpc-epi-php.c
U   php/php-src/branches/PHP_5_4/NEWS
A   php/php-src/branches/PHP_5_4/ext/xmlrpc/tests/bug61264.phpt
U   php/php-src/branches/PHP_5_4/ext/xmlrpc/xmlrpc-epi-php.c
A   php/php-src/trunk/ext/xmlrpc/tests/bug61264.phpt
U   php/php-src/trunk/ext/xmlrpc/xmlrpc-epi-php.c

Modified: php/php-src/branches/PHP_5_3/NEWS
===
--- php/php-src/branches/PHP_5_3/NEWS   2012-03-02 23:07:19 UTC (rev 323849)
+++ php/php-src/branches/PHP_5_3/NEWS   2012-03-03 12:46:17 UTC (rev 323850)
@@ -73,6 +73,7 @@

 - XMLRPC:
   . Fixed bug #61097 (Memory leak in xmlrpc functions copying zvals). (Nikic)
+  . Fixed bug #61264 (xmlrpc_parse_method_descriptions leaks temporary 
variable). (Nikita Popov)

 - Zlib:
   . Fixed bug #61139 (gzopen leaks when specifying invalid mode). (Nikic)

Added: php/php-src/branches/PHP_5_3/ext/xmlrpc/tests/bug61264.phpt
===
--- php/php-src/branches/PHP_5_3/ext/xmlrpc/tests/bug61264.phpt 
(rev 0)
+++ php/php-src/branches/PHP_5_3/ext/xmlrpc/tests/bug61264.phpt 2012-03-03 
12:46:17 UTC (rev 323850)
@@ -0,0 +1,17 @@
+--TEST--
+Bug #61264: xmlrpc_parse_method_descriptions leaks temporary variable
+--FILE--
+?php
+$xml = XML
+?xml version=1.0 encoding=utf-8?
+a
+ bfoo/b
+/a
+XML;
+var_dump(xmlrpc_parse_method_descriptions($xml));
+?
+--EXPECT--
+array(1) {
+  [b]=
+  string(3) foo
+}

Modified: php/php-src/branches/PHP_5_3/ext/xmlrpc/xmlrpc-epi-php.c
===
--- php/php-src/branches/PHP_5_3/ext/xmlrpc/xmlrpc-epi-php.c2012-03-02 
23:07:19 UTC (rev 323849)
+++ php/php-src/branches/PHP_5_3/ext/xmlrpc/xmlrpc-epi-php.c2012-03-03 
12:46:17 UTC (rev 323850)
@@ -1240,8 +1240,7 @@
retval = XMLRPC_to_PHP(xVal);

if (retval) {
-   *return_value = *retval;
-   zval_copy_ctor(return_value);
+   RETVAL_ZVAL(retval, 1, 1);
}
/* dust, sweep, and mop */
XMLRPC_CleanupValue(xVal);

Modified: php/php-src/branches/PHP_5_4/NEWS
===
--- php/php-src/branches/PHP_5_4/NEWS   2012-03-02 23:07:19 UTC (rev 323849)
+++ php/php-src/branches/PHP_5_4/NEWS   2012-03-03 12:46:17 UTC (rev 323850)
@@ -48,6 +48,7 @@

 - XMLRPC:
   . Fixed bug #61097 (Memory leak in xmlrpc functions copying zvals). (Nikita 
Popov)
+  . Fixed bug #61264 (xmlrpc_parse_method_descriptions leaks temporary 
variable). (Nikita Popov)

 - Zlib:
   . Fixed bug #61139 (gzopen leaks when specifying invalid mode). (Nikita 
Popov)

Added: php/php-src/branches/PHP_5_4/ext/xmlrpc/tests/bug61264.phpt
===
--- php/php-src/branches/PHP_5_4/ext/xmlrpc/tests/bug61264.phpt 
(rev 0)
+++ php/php-src/branches/PHP_5_4/ext/xmlrpc/tests/bug61264.phpt 2012-03-03 
12:46:17 UTC (rev 323850)
@@ -0,0 +1,17 @@
+--TEST--
+Bug #61264: xmlrpc_parse_method_descriptions leaks temporary variable
+--FILE--
+?php
+$xml = XML
+?xml version=1.0 encoding=utf-8?
+a
+ bfoo/b
+/a
+XML;
+var_dump(xmlrpc_parse_method_descriptions($xml));
+?
+--EXPECT--
+array(1) {
+  [b]=
+  string(3) foo
+}

Modified: php/php-src/branches/PHP_5_4/ext/xmlrpc/xmlrpc-epi-php.c
===
--- php/php-src/branches/PHP_5_4/ext/xmlrpc/xmlrpc-epi-php.c2012-03-02 
23:07:19 UTC (rev 323849)
+++ php/php-src/branches/PHP_5_4/ext/xmlrpc/xmlrpc-epi-php.c2012-03-03 
12:46:17 UTC (rev 323850)
@@ -1240,8 +1240,7 @@
retval = XMLRPC_to_PHP(xVal);

if (retval) {
-   *return_value = *retval;
-   zval_copy_ctor(return_value);
+   RETVAL_ZVAL(retval, 1, 1);
}
/* dust, sweep, and mop */
XMLRPC_CleanupValue(xVal);

Added: php/php-src/trunk/ext/xmlrpc/tests/bug61264.phpt
===
--- php/php-src/trunk/ext/xmlrpc/tests/bug61264.phpt
(rev 0)
+++ php/php-src/trunk/ext/xmlrpc/tests/bug61264.phpt2012-03-03 12:46:17 UTC 

[PHP-CVS] [git] karma.git branch PHP_POST_RECEIVE created. 5d58ad7

2012-03-03 Thread irker
The branch, PHP_POST_RECEIVE on karma.git has been created
at  5d58ad7ac1700df5ad7d9bf50b73b80b71ce9844 (commit)

-- Log 
commit 5d58ad7ac1700df5ad7d9bf50b73b80b71ce9844
Author: Alexander Moskaliov ir...@php.net
Date:   Sat Mar 3 16:46:15 2012 +0400

Start rewrite post-receive on php

diff --git a/hooks/post-receive b/hooks/post-receive
index 3a45616..5576fe4 100755
--- a/hooks/post-receive
+++ b/hooks/post-receive
@@ -1,754 +1,43 @@
-#!/bin/sh
-#
-# Copyright (c) 2007 Andy Parkins
-#
-# An example hook script to mail out commit update information.  This hook
-# sends emails listing new revisions to the repository introduced by the
-# change being reported.  The rule is that (for branch updates) each commit
-# will appear on one email and one email only.
-#
-# This hook is stored in the contrib/hooks directory.  Your distribution
-# will have put this somewhere standard.  You should make this script
-# executable then link to it in the repository you would like to use it in.
-# For example, on debian the hook is stored in
-# /usr/share/git-core/contrib/hooks/post-receive-email:
-#
-#  chmod a+x post-receive-email
-#  cd /path/to/your/repository.git
-#  ln -sf /usr/share/git-core/contrib/hooks/post-receive-email 
hooks/post-receive
-#
-# This hook script assumes it is enabled on the central repository of a
-# project, with all users pushing only to it and not between each other.  It
-# will still work if you don't operate in that style, but it would become
-# possible for the email to be from someone other than the person doing the
-# push.
-#
-# To help with debugging and use on pre-v1.5.1 git servers, this script will
-# also obey the interface of hooks/update, taking its arguments on the
-# command line.  Unfortunately, hooks/update is called once for each ref.
-# To avoid firing one email per ref, this script just prints its output to
-# the screen when used in this mode.  The output can then be redirected if
-# wanted.
-#
-# Config
-# --
-# hooks.mailinglist
-#   This is the list that all pushes will go to; leave it blank to not send
-#   emails for every ref update.
-# hooks.announcelist
-#   This is the list that all pushes of annotated tags will go to.  Leave it
-#   blank to default to the mailinglist field.  The announce emails lists
-#   the short log summary of the changes since the last annotated tag.
-# hooks.envelopesender
-#   If set then the -f option is passed to sendmail to allow the envelope
-#   sender address to be set
-# hooks.emailprefix
-#   All emails have their subjects prefixed with this prefix, or [SCM]
-#   if emailprefix is unset, to aid filtering
-# hooks.showrev
-#   The shell command used to format each revision in the email, with
-#   %s replaced with the commit id.  Defaults to git rev-list -1
-#   --pretty %s, displaying the commit id, author, date and log
-#   message.  To list full patches separated by a blank line, you
-#   could set this to git show -C %s; echo.
-#   To list a gitweb/cgit URL *and* a full patch for each change set, use this:
-# t=%s; printf 'http://.../?id=%%s' \$t; echo;echo; git show -C \$t; echo
-#   Be careful if ... contains things that will be expanded by shell eval
-#   or printf.
-# hooks.emailmaxlines
-#   The maximum number of lines that should be included in the generated
-#   email body. If not specified, there is no limit.
-#   Lines beyond the limit are suppressed and counted, and a final
-#   line is added indicating the number of suppressed lines.
-# hooks.diffopts
-#   Alternate options for the git diff-tree invocation that shows changes.
-#   Default is --stat --summary --find-copies-harder. Add -p to those
-#   options to include a unified diff of changes in addition to the usual
-#   summary output.
-#
-# Notes
-# -
-# All emails include the headers X-Git-Refname, X-Git-Oldrev,
-# X-Git-Newrev, and X-Git-Reftype to enable fine tuned filtering and
-# give information for debugging.
-#
+#!/usr/bin/env php
+?php
+namespace Karma;
 
-#  Functions
+// STATUS: not worked
+// TODO: add license
+// TODO: mails per commit
+// TODO: refactor with lib/Git
+// TODO: documentation
+// TODO: refactor for PHP 5.4
+// TODO: reformat mails
+// TODO: check mail length
 
-#
-# Function to prepare for email generation. This decides what type
-# of update this is and whether an email should even be generated.
-#
-prep_for_email()
-{
-   # --- Arguments
-   oldrev=$(git rev-parse $1)
-   newrev=$(git rev-parse $2)
-   refname=$3
-   maxlines=$4
 
-   # --- Interpret
-   # -1234 (create)
-   # 1234-2345 (update)
-   # 2345- (delete)
-   if expr $oldrev : '0*$' /dev/null
-   then
-   change_type=create
-   else
-   if expr $newrev : '0*$' /dev/null
-   then
-   change_type=delete
-   else
-   change_type=update
-  

[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/NEWS branches/PHP_5_3/ext/standard/tests/streams/bug60106.phpt branches/PHP_5_3/main/streams/xp_socket.c branches/PHP_5_4/NEWS branches/PHP_5_4/ext/standa

2012-03-03 Thread Ilia Alshanetsky
iliaaSat, 03 Mar 2012 20:36:14 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=323852

Log:
Fixed bug #60106 (stream_socket_server silently truncates long unix socket 
paths)

Bug: https://bugs.php.net/60106 (Open) stream_socket_server + long unix socket 
path = 'Unknown error'
  
Changed paths:
U   php/php-src/branches/PHP_5_3/NEWS
A   php/php-src/branches/PHP_5_3/ext/standard/tests/streams/bug60106.phpt
U   php/php-src/branches/PHP_5_3/main/streams/xp_socket.c
U   php/php-src/branches/PHP_5_4/NEWS
A   php/php-src/branches/PHP_5_4/ext/standard/tests/streams/bug60106.phpt
U   php/php-src/branches/PHP_5_4/main/streams/xp_socket.c
A   php/php-src/trunk/ext/standard/tests/streams/bug60106.phpt
U   php/php-src/trunk/main/streams/xp_socket.c

Modified: php/php-src/branches/PHP_5_3/NEWS
===
--- php/php-src/branches/PHP_5_3/NEWS	2012-03-03 15:08:21 UTC (rev 323851)
+++ php/php-src/branches/PHP_5_3/NEWS	2012-03-03 20:36:14 UTC (rev 323852)
@@ -62,6 +62,8 @@
 - Streams:
   . Fixed bug #61115 (stream related segfault on fatal error in
 php_stream_context_link). (Gustavo)
+  . Fixed bug #60106 (stream_socket_server silently truncates long unix
+socket paths). (Ilia)
   . Further fix for bug #60455 (stream_get_line misbehaves if EOF is not
 detected together with the last read). (Gustavo)
   . Fixed bug #60817 (stream_get_line() reads from stream even when there is

Added: php/php-src/branches/PHP_5_3/ext/standard/tests/streams/bug60106.phpt
===
--- php/php-src/branches/PHP_5_3/ext/standard/tests/streams/bug60106.phpt	(rev 0)
+++ php/php-src/branches/PHP_5_3/ext/standard/tests/streams/bug60106.phpt	2012-03-03 20:36:14 UTC (rev 323852)
@@ -0,0 +1,14 @@
+--TEST--
+Bug#60106 (stream_socket_server silently truncates long unix socket paths)
+--FILE--
+?php
+	error_reporting(E_ALL | E_NOTICE);
+	stream_socket_server(unix:///tmp/ . str_repeat(a, 4096));
+?
+===DONE===
+--EXPECTF--
+Notice: stream_socket_server(): socket path exceeded the maximum allowed length of %d bytes and was truncated in %s on line %d
+
+Warning: stream_socket_server(): unable to connect to unix:///tmp/aaa in %s on line %d
+===DONE===
+

Modified: php/php-src/branches/PHP_5_3/main/streams/xp_socket.c
===
--- php/php-src/branches/PHP_5_3/main/streams/xp_socket.c	2012-03-03 15:08:21 UTC (rev 323851)
+++ php/php-src/branches/PHP_5_3/main/streams/xp_socket.c	2012-03-03 20:36:14 UTC (rev 323852)
@@ -514,6 +514,7 @@
 		 * BUT, to get into this branch of code, the name is too long,
 		 * so we don't care. */
 		xparam-inputs.namelen = sizeof(unix_addr-sun_path) - 1;
+		php_error_docref(NULL TSRMLS_CC, E_NOTICE, socket path exceeded the maximum allowed length of %ld bytes and was truncated, sizeof(unix_addr-sun_path));
 	}

 	memcpy(unix_addr-sun_path, xparam-inputs.name, xparam-inputs.namelen);

Modified: php/php-src/branches/PHP_5_4/NEWS
===
--- php/php-src/branches/PHP_5_4/NEWS	2012-03-03 15:08:21 UTC (rev 323851)
+++ php/php-src/branches/PHP_5_4/NEWS	2012-03-03 20:36:14 UTC (rev 323852)
@@ -45,6 +45,7 @@
 - Standard:
   . Fixed memory leak in substr_replace. (Pierrick)
   . Make max_file_uploads ini directive settable outside of php.ini (Rasmus)
+  . Fixed bug #60106 (stream_socket_server silently truncates long unix socket paths). (Ilia)

 - XMLRPC:
   . Fixed bug #61097 (Memory leak in xmlrpc functions copying zvals). (Nikita Popov)

Added: php/php-src/branches/PHP_5_4/ext/standard/tests/streams/bug60106.phpt
===
--- php/php-src/branches/PHP_5_4/ext/standard/tests/streams/bug60106.phpt	(rev 0)
+++ 

[PHP-CVS] [git] karma.git branch master updated. 002a63c

2012-03-03 Thread dsp
The branch, master on karma.git has been updated
   via  002a63c12dc1eadb3885d9fc5c6b97cf3863913a (commit)
   via  f3d11575dc77ab1cc7eda290a4366122b923b1c1 (commit)
   via  51ca66d43a28b1c50cfd4e994712bc577e440e52 (commit)
   via  c358027fd70d57b60f12b620dc78f6fe7c384aec (commit)
  from  8d595325d65b7de86651483a1705a0ee2a4b4bd5 (commit)

http://git.php.net/?p=karma.git;a=log;h=002a63c12dc1eadb3885d9fc5c6b97cf3863913a;hp=8d595325d65b7de86651483a1705a0ee2a4b4bd5

Summary of changes:
 hooks/pre-receive   |   29 +-
 lib/Git.php |   25 
 lib/Git/PushInformation.php |   86 +++
 lib/Git/ReceiveHook.php |   43 +
 4 files changed, 148 insertions(+), 35 deletions(-)
 create mode 100644 lib/Git.php
 create mode 100644 lib/Git/PushInformation.php

-- Log 
commit 002a63c12dc1eadb3885d9fc5c6b97cf3863913a
Author: David Soria Parra d...@php.net
Date:   Fri Mar 2 03:06:30 2012 +0100

Require access to all the repository in case we do a forced push

A forced push can happen when you delete a tag or rewrite commits. We allow
this, but only if you have access to the root of the repository.

diff --git a/hooks/pre-receive b/hooks/pre-receive
index 46195a4..48da31b 100755
--- a/hooks/pre-receive
+++ b/hooks/pre-receive
@@ -11,11 +11,15 @@ namespace Karma;
 
 const KARMA_FILE = '/git/checkout/SVNROOT/global_avail';
 const REPOSITORY_PATH = '/git/repositories';
+const LIB_PATH = '/git/checkout/karma/lib';
 
-set_include_path('/git/checkout/karma/lib' .
+set_include_path(
+getenv('KARMA_LIB_PATH') ?: LIB_PATH .
 PATH_SEPARATOR .
 get_include_path());
 
+include 'Git.php';
+include 'Git/PushInformation.php';
 include 'Git/ReceiveHook.php';
 
 function deny($reason)
@@ -107,16 +111,19 @@ if ($hook-isKarmaIgnored()) {
 accept(No karma check necessary. Thank you for your contribution.\n);
 }
 
-$requested_paths = $hook-getReceivedPaths();
+$repo_name = $hook-getRepositoryName();
+$pi= new \Git\PushInformation($hook);
+$req_paths = ($pi-isForced()) ? [''] : $hook-getReceivedPaths();
+var_dump($pi-isForced());
 
-if (empty($requested_paths)) {
+if (empty($req_paths)) {
 deny(We cannot figure out what you comitted!);
 }
 
-$prefix  = sprintf('%s/', $hook-getRepositoryName());
+$prefix  = sprintf('%s/', $repo_name);
 $avail_lines = $hook-getKarmaFile();
-$requested_paths = array_map(function ($x) use ($prefix) { return $prefix . 
$x;}, $requested_paths);
-$unavail_paths   = get_unavail_paths($user, $requested_paths, $avail_lines);
+$req_paths   = array_map(function ($x) use ($prefix) { return $prefix . 
$x;}, $req_paths);
+$unavail_paths   = get_unavail_paths($user, $req_paths, $avail_lines);
 
 if (!empty($unavail_paths)) {
 deny(sprintf(
diff --git a/lib/Git/PushInformation.php b/lib/Git/PushInformation.php
new file mode 100644
index 000..edf73dc
--- /dev/null
+++ b/lib/Git/PushInformation.php
@@ -0,0 +1,86 @@
+?php
+namespace Git;
+
+class PushInformation
+{
+const GIT_EXECUTABLE = 'git';
+
+private $karmaFile;
+private $repositoryBasePath;
+
+private $hook= null;
+private $repourl = null;
+
+public function __construct(ReceiveHook $hook)
+{
+$this-repourl = \Git::getRepositoryPath();
+$this-hook= $hook;
+}
+
+/**
+ * Returns the common ancestor revision for two given revisions
+ *
+ * Returns false if no sha1 was returned. Throws an exception if calling
+ * git fails.
+ *
+ * @return boolean
+ */
+protected function mergeBase($oldrev, $newrev)
+{
+$baserev = exec(sprintf('%s --git-dir=%s merge-base %s %s',
+\Git::GIT_EXECUTABLE,
+$this-repourl,
+escapeshellarg($oldrev),
+escapeshellarg($newrev)), $output, $retval);
+
+$baserev = trim($baserev);
+
+if (0 !== $retval) {
+throw new \Exception('Failed to call git');
+}
+
+if (40 != strlen($baserev)) {
+return false;
+}
+
+return $baserev;
+}
+
+/**
+ * Returns true if merging $newrev would be fast forward
+ *
+ * @return boolean
+ */
+public function isFastForward()
+{
+$result = $this-hook-mapInput(
+function ($oldrev, $newrev) {
+if ($oldrev == \Git::NULLREV) {
+return true;
+}
+return $oldrev == $this-mergeBase($oldrev, $newrev);
+});
+
+return array_reduce($result, function($a, $b) { return $a  $b; }, 
true);
+}
+
+/**
+ * Returns true if updating the refs would fail if push is not forced.
+ *
+ * @return boolean
+ */
+public function isForced()
+{
+$result = $this-hook-mapInput(
+

Re: [PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/NEWS branches/PHP_5_3/ext/standard/tests/streams/bug60106.phpt branches/PHP_5_3/main/streams/xp_socket.c branches/PHP_5_4/NEWS branches/PHP_5_4/ext/st

2012-03-03 Thread Laruence
Hi:
   is a WARNING better?  :)

thanks

On Sun, Mar 4, 2012 at 4:36 AM, Ilia Alshanetsky il...@php.net wrote:
 iliaa                                    Sat, 03 Mar 2012 20:36:14 +

 Revision: http://svn.php.net/viewvc?view=revisionrevision=323852

 Log:
 Fixed bug #60106 (stream_socket_server silently truncates long unix socket 
 paths)

 Bug: https://bugs.php.net/60106 (Open) stream_socket_server + long unix 
 socket path = 'Unknown error'

 Changed paths:
    U   php/php-src/branches/PHP_5_3/NEWS
    A   php/php-src/branches/PHP_5_3/ext/standard/tests/streams/bug60106.phpt
    U   php/php-src/branches/PHP_5_3/main/streams/xp_socket.c
    U   php/php-src/branches/PHP_5_4/NEWS
    A   php/php-src/branches/PHP_5_4/ext/standard/tests/streams/bug60106.phpt
    U   php/php-src/branches/PHP_5_4/main/streams/xp_socket.c
    A   php/php-src/trunk/ext/standard/tests/streams/bug60106.phpt
    U   php/php-src/trunk/main/streams/xp_socket.c


 --
 PHP CVS Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php



-- 
Laruence  Xinchen Hui
http://www.laruence.com/

--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php