[PHP-CVS] [git] karma.git branch PHP_POST_RECEIVE updated. 99a863d

2012-03-14 Thread irker
The branch PHP_POST_RECEIVE on karma.git has been updated
   via  99a863d4846676c53e15031cdc217c264aa082f8 (commit)
   via  91e9caf26371fc75f01faa4a1e7f0a9729313c4e (commit)
   via  8965fe78b0a0e1a1fca87677183472a8eb0ae8e9 (commit)
   via  57727b422a5df298c6db0ba73d2aa4eab3b76fb8 (commit)
   via  b8e2e76374106a75687c430597ac8a352c7e514e (commit)
  from  30a1031bfb19338e8eb5cfabc72c7352d6f38a18 (commit)

http://git.php.net/?p=karma.git;a=log;h=99a863d4846676c53e15031cdc217c264aa082f8;hp=30a1031bfb19338e8eb5cfabc72c7352d6f38a18

Summary of changes:
 hooks/post-receive|   48 +-
 hooks/{post-receive = post-receive.mail} |6 +-
 lib/Git/PostReceiveHook.php   |  271 +++--
 3 files changed, 180 insertions(+), 145 deletions(-)
 copy hooks/{post-receive = post-receive.mail} (88%)

-- Log 
commit 99a863d4846676c53e15031cdc217c264aa082f8
Author: Alexander Moskaliov ir...@php.net
Date:   Wed Mar 14 17:25:37 2012 +0400

separate post-recive script

diff --git a/hooks/post-receive b/hooks/post-receive
index cc37b0b..6121887 100755
--- a/hooks/post-receive
+++ b/hooks/post-receive
@@ -1,44 +1,3 @@
-#!/usr/bin/env php
-?php
-namespace Karma;
-
-// STATUS: not worked
-// TODO: add license
-// TODO: refactor
-// TODO: documentation
-// TODO: run post-receive.mirror
-
-
-// /git/users.db
-
-error_reporting(E_ALL | E_STRICT);
-date_default_timezone_set('UTC');
-putenv(PATH=/opt/bin:/usr/local/bin:/usr/bin:/bin);
-putenv(LC_ALL=en_US.UTF-8);
-mb_internal_encoding(UTF-8);
-
-const REPOSITORY_PATH = '/git/repositories';
-
-set_include_path('/git/checkout/karma/lib' .
-PATH_SEPARATOR .
-get_include_path());
-
-include 'Mail.php';
-include 'Git.php';
-include 'Git/ReceiveHook.php';
-include 'Git/PostReceiveHook.php';
-
-
-$recipients = exec('git config hooks.mailinglist');
-$emailPrefix = exec('git config hooks.emailprefix') ?: '[git]';
-
-$user = null;
-if (getenv('REMOTE_USER')) {
-$user = getenv('REMOTE_USER');
-} else if (getenv('SSH_CONNECTION')  getenv('GL_USER')) {
-/* gitolite user */
-$user = getenv('GL_USER');
-}
-
-$hook = new \Git\PostReceiveHook(getenv('GL_REPO_BASE_ABS') ?: 
REPOSITORY_PATH, $user, $recipients, $emailPrefix);
-$hook-process();
\ No newline at end of file
+#!/bin/sh
+[ -f 'hooks/post-receive.mail' ]hooks/post-receive.mail
+[ -f 'hooks/post-receive.mirror' ]  hooks/post-receive.mirror
diff --git a/hooks/post-receive b/hooks/post-receive.mail
similarity index 95%
copy from hooks/post-receive
copy to hooks/post-receive.mail
index cc37b0b..af9bcd5 100755
--- a/hooks/post-receive
+++ b/hooks/post-receive.mail
@@ -6,7 +6,6 @@ namespace Karma;
 // TODO: add license
 // TODO: refactor
 // TODO: documentation
-// TODO: run post-receive.mirror
 
 
 // /git/users.db

commit 91e9caf26371fc75f01faa4a1e7f0a9729313c4e
Author: Alexander Moskaliov ir...@php.net
Date:   Wed Mar 14 16:57:04 2012 +0400

add bugs info in commit mail

diff --git a/lib/Git/PostReceiveHook.php b/lib/Git/PostReceiveHook.php
index a635ab0..a9b0180 100644
--- a/lib/Git/PostReceiveHook.php
+++ b/lib/Git/PostReceiveHook.php
@@ -401,6 +401,23 @@ class PostReceiveHook extends ReceiveHook
 return $this-commitsData[$revision];
 }
 
+private function getBugs($log)
+{
+$bugUrlPrefixes = [
+'pear' = 'http://pear.php.net/bugs/',
+'pecl' = 'https://bugs.php.net/',
+'php' = 'https://bugs.php.net/',
+'' = 'https://bugs.php.net/'
+];
+$bugs = [];
+if 
(preg_match_all('/(?:(pecl|pear|php)\s*)?(?:bug|#)[\s#:]*([0-9]+)/iuX', $log, 
$matchedBugs, PREG_SET_ORDER)) {
+foreach($matchedBugs as $bug) {
+$bugs[] = $bugUrlPrefixes[$bug[1]] . $bug[2];
+}
+}
+return $bugs;
+}
+
 /**
  * Send mail about commit.
  * Subject: [git] [commit] %PROJECT%: %PATHS%
@@ -455,6 +472,10 @@ class PostReceiveHook extends ReceiveHook
 
 $message .= \nLog:\n . $info['log'] . \n;
 
+if ($bugs = $this-getBugs($info['log'])) {
+$message .= \nBugs:\n . implode(\n, $bugs) . \n;
+}
+
 
 if (strlen($pathsString)  8192) {
 // inline changed paths

commit 8965fe78b0a0e1a1fca87677183472a8eb0ae8e9
Author: Alexander Moskaliov ir...@php.net
Date:   Wed Mar 14 16:33:44 2012 +0400

add push user fullname from users.db

diff --git a/hooks/post-receive b/hooks/post-receive
index 12884a4..cc37b0b 100755
--- a/hooks/post-receive
+++ b/hooks/post-receive
@@ -4,11 +4,10 @@ namespace Karma;
 
 // STATUS: not worked
 // TODO: add license
-// TODO: refactor with lib/Git
+// TODO: refactor
 // TODO: documentation
-// TODO: refactor for PHP 5.4
-// TODO: reformat mails
-// TODO: check mail length
+// TODO: run post-receive.mirror
+
 
 // /git/users.db
 
diff --git a/lib/Git/PostReceiveHook.php b/lib/Git/PostReceiveHook.php

[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/mysqli/tests/mysqli_report.phpt branches/PHP_5_4/ext/mysqli/tests/mysqli_report.phpt trunk/ext/mysqli/tests/mysqli_report.phpt

2012-03-14 Thread Ulf Wendel
uw   Wed, 14 Mar 2012 14:55:09 +

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

Log:
Test for MySQL version.Variable is deprecated in MySQL 5.6.

Changed paths:
U   php/php-src/branches/PHP_5_3/ext/mysqli/tests/mysqli_report.phpt
U   php/php-src/branches/PHP_5_4/ext/mysqli/tests/mysqli_report.phpt
U   php/php-src/trunk/ext/mysqli/tests/mysqli_report.phpt

Modified: php/php-src/branches/PHP_5_3/ext/mysqli/tests/mysqli_report.phpt
===
--- php/php-src/branches/PHP_5_3/ext/mysqli/tests/mysqli_report.phpt	2012-03-14 14:05:54 UTC (rev 324241)
+++ php/php-src/branches/PHP_5_3/ext/mysqli/tests/mysqli_report.phpt	2012-03-14 14:55:09 UTC (rev 324242)
@@ -194,37 +194,39 @@
 	if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
 		printf([017] [%d] %s\n, mysqli_connect_errno(), mysqli_connect_error());

-	// this might cause a warning - no index used
-	if (!$res = @mysqli_query($link, SHOW VARIABLES LIKE 'log_slow_queries'))
-		printf([018] [%d] %s\n, mysqli_errno($link), mysqli_error($link));
+	if (mysqli_get_server_version($link) = 50600) {
+		// this might cause a warning - no index used
+		if (!$res = @mysqli_query($link, SHOW VARIABLES LIKE 'log_slow_queries'))
+			printf([018] [%d] %s\n, mysqli_errno($link), mysqli_error($link));

-	if (!$row = mysqli_fetch_assoc($res))
-		printf([019] [%d] %s\n, mysqli_errno($link), mysqli_error($link));
+		if (!$row = mysqli_fetch_assoc($res))
+			printf([019] [%d] %s\n, mysqli_errno($link), mysqli_error($link));

-	$log_slow_query = ('ON' == $row['Value']);
+		$log_slow_query = ('ON' == $row['Value']);

-	if (mysqli_get_server_version($link) = 51011) {
-		// this might cause a warning - no index used
-		if (!$res = @mysqli_query($link, SHOW VARIABLES LIKE 'log_queries_not_using_indexes'))
-			printf([020] [%d] %s\n, mysqli_errno($link), mysqli_error($link));
+		if (mysqli_get_server_version($link) = 50111) {
+			// this might cause a warning - no index used
+			if (!$res = @mysqli_query($link, SHOW VARIABLES LIKE 'log_queries_not_using_indexes'))
+printf([020] [%d] %s\n, mysqli_errno($link), mysqli_error($link));

-		if (!$row = mysqli_fetch_assoc($res))
-			printf([021] [%d] %s\n, mysqli_errno($link), mysqli_error($link));
+			if (!$row = mysqli_fetch_assoc($res))
+printf([021] [%d] %s\n, mysqli_errno($link), mysqli_error($link));

-		$log_queries_not_using_indexes = ('ON' == $row['Value']);
+			$log_queries_not_using_indexes = ('ON' == $row['Value']);

-		if ($log_slow_queries  $log_queries_not_using_indexes) {
+			if ($log_slow_queries  $log_queries_not_using_indexes) {

-			for ($i = 100; $i  2; $i++) {
-if (!mysqli_query($link, INSERT INTO test(id, label) VALUES ($i, 'z')))
-	printf([022 - %d] [%d] %s\n, $i - 99, mysqli_errno($link), mysqli_error($link));
-			}
+for ($i = 100; $i  2; $i++) {
+	if (!mysqli_query($link, INSERT INTO test(id, label) VALUES ($i, 'z')))
+		printf([022 - %d] [%d] %s\n, $i - 99, mysqli_errno($link), mysqli_error($link));
+}

-			// this might cause a warning - no index used
-			if (!$res = @mysqli_query($link, SELECT id, label FROM test WHERE id = 1323))
-printf([023] [%d] %s\n, mysqli_errno($link), mysqli_error($link));
+// this might cause a warning - no index used
+if (!$res = @mysqli_query($link, SELECT id, label FROM test WHERE id = 1323))
+	printf([023] [%d] %s\n, mysqli_errno($link), mysqli_error($link));

-			mysqli_free_result($res);
+mysqli_free_result($res);
+			}
 		}
 	}


Modified: php/php-src/branches/PHP_5_4/ext/mysqli/tests/mysqli_report.phpt
===
--- php/php-src/branches/PHP_5_4/ext/mysqli/tests/mysqli_report.phpt	2012-03-14 14:05:54 UTC (rev 324241)
+++ php/php-src/branches/PHP_5_4/ext/mysqli/tests/mysqli_report.phpt	2012-03-14 14:55:09 UTC (rev 324242)
@@ -194,37 +194,39 @@
 	if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
 		printf([017] [%d] %s\n, mysqli_connect_errno(), mysqli_connect_error());

-	// this might cause a warning - no index used
-	if (!$res = @mysqli_query($link, SHOW VARIABLES LIKE 'log_slow_queries'))
-		printf([018] [%d] %s\n, mysqli_errno($link), mysqli_error($link));
+	if (mysqli_get_server_version($link) = 50600) {
+		// this might cause a warning - no index used
+		if (!$res = @mysqli_query($link, SHOW VARIABLES LIKE 'log_slow_queries'))
+			printf([018] [%d] %s\n, mysqli_errno($link), mysqli_error($link));

-	if (!$row = mysqli_fetch_assoc($res))
-		printf([019] [%d] %s\n, mysqli_errno($link), mysqli_error($link));
+		if (!$row = mysqli_fetch_assoc($res))
+			printf([019] [%d] %s\n, mysqli_errno($link), mysqli_error($link));

-	$log_slow_query = ('ON' == $row['Value']);
+		$log_slow_query = ('ON' == $row['Value']);

-	if (mysqli_get_server_version($link) = 51011) {
-		// this might cause a 

[PHP-CVS] [git] karma.git branch PHP_POST_RECEIVE updated. cffd3b3

2012-03-14 Thread irker
The branch PHP_POST_RECEIVE on karma.git has been updated
   via  cffd3b39b05fae71090586fcc9f717f857c20ae0 (commit)
  from  99a863d4846676c53e15031cdc217c264aa082f8 (commit)

http://git.php.net/?p=karma.git;a=log;h=cffd3b39b05fae71090586fcc9f717f857c20ae0;hp=99a863d4846676c53e15031cdc217c264aa082f8

Summary of changes:
 README.POST_RECEIVE = README.POST_RECEIVE_MAIL |0
 hooks/post-receive.mail |   20 ++---
 lib/Git.php |3 +-
 lib/Git/PostReceiveHook.php |   51 ---
 lib/Git/PreReceiveHook.php  |2 +-
 lib/Git/ReceiveHook.php |2 +-
 6 files changed, 44 insertions(+), 34 deletions(-)
 rename README.POST_RECEIVE = README.POST_RECEIVE_MAIL (100%)

-- Log 
commit cffd3b39b05fae71090586fcc9f717f857c20ae0
Author: Alexander Moskaliov ir...@php.net
Date:   Wed Mar 14 21:46:03 2012 +0400

many bugfixes

diff --git a/README.POST_RECEIVE b/README.POST_RECEIVE_MAIL
similarity index 100%
rename from README.POST_RECEIVE
rename to README.POST_RECEIVE_MAIL
diff --git a/hooks/post-receive.mail b/hooks/post-receive.mail
index af9bcd5..aacadef 100755
--- a/hooks/post-receive.mail
+++ b/hooks/post-receive.mail
@@ -8,8 +8,6 @@ namespace Karma;
 // TODO: documentation
 
 
-// /git/users.db
-
 error_reporting(E_ALL | E_STRICT);
 date_default_timezone_set('UTC');
 putenv(PATH=/opt/bin:/usr/local/bin:/usr/bin:/bin);
@@ -17,10 +15,14 @@ putenv(LC_ALL=en_US.UTF-8);
 mb_internal_encoding(UTF-8);
 
 const REPOSITORY_PATH = '/git/repositories';
+const LIB_PATH = '/git/checkout/karma/lib';
+const USERS_DB_FILE = '/git/users.db';
+
+set_include_path(
+getenv('KARMA_LIB_PATH') ?: LIB_PATH .
+PATH_SEPARATOR .
+get_include_path());
 
-set_include_path('/git/checkout/karma/lib' .
-PATH_SEPARATOR .
-get_include_path());
 
 include 'Mail.php';
 include 'Git.php';
@@ -39,5 +41,11 @@ if (getenv('REMOTE_USER')) {
 $user = getenv('GL_USER');
 }
 
-$hook = new \Git\PostReceiveHook(getenv('GL_REPO_BASE_ABS') ?: 
REPOSITORY_PATH, $user, $recipients, $emailPrefix);
+$hook = new \Git\PostReceiveHook(
+getenv('GL_REPO_BASE_ABS') ?: REPOSITORY_PATH,
+$user,
+getenv('USERS_DB_FILE') ?: USERS_DB_FILE,
+$recipients,
+$emailPrefix
+);
 $hook-process();
\ No newline at end of file
diff --git a/lib/Git.php b/lib/Git.php
index 87e5fa9..fc0f0c9 100644
--- a/lib/Git.php
+++ b/lib/Git.php
@@ -40,7 +40,6 @@ class Git
 array_shift($args);
 $cmd = vsprintf($cmd, $args);
 $output = shell_exec($cmd);
-if ($output === NULL) throw new \Exception('Failed to call git');
-return $output;
+return (string)$output;
 }
 }
diff --git a/lib/Git/PostReceiveHook.php b/lib/Git/PostReceiveHook.php
index a9b0180..589e96a 100644
--- a/lib/Git/PostReceiveHook.php
+++ b/lib/Git/PostReceiveHook.php
@@ -3,12 +3,12 @@ namespace Git;
 
 class PostReceiveHook extends ReceiveHook
 {
-const USERS_DB_FILE = '/git/users.db';
 
 private $pushAuthor = '';
 private $pushAuthorName = '';
 private $mailingList = '';
 private $emailPrefix = '';
+private $usersFile = '';
 
 private $alreadyExistsBranches = [];
 private $updatedBranches = [];
@@ -20,13 +20,15 @@ class PostReceiveHook extends ReceiveHook
 /**
  * @param $basePath string
  * @param $pushAuthor string
+ * @param $usersFile string
  * @param $mailingList string
  * @param $emailPrefix string
  */
-public function __construct($basePath, $pushAuthor, $mailingList, 
$emailPrefix)
+public function __construct($basePath, $pushAuthor, $usersFile, 
$mailingList, $emailPrefix)
 {
 parent::__construct($basePath);
 
+$this-usersFile = $usersFile;
 $this-pushAuthor = $pushAuthor;
 $this-pushAuthorName = $this-getUserName($pushAuthor);
 $this-mailingList = $mailingList;
@@ -37,7 +39,7 @@ class PostReceiveHook extends ReceiveHook
 
 public function getUserName($user)
 {
-$usersDB = file(__DIR__ . '/users.db');
+$usersDB = file($this-usersFile);
 foreach ($usersDB as $userline) {
 list ($username, $fullname, $email) = explode(:, 
trim($userline));
 if ($username === $user) {
@@ -79,7 +81,7 @@ class PostReceiveHook extends ReceiveHook
 }
 
 // sort revisions by commit time
-usort($this-revisions, function($a, $b){
+uksort($this-revisions, function($a, $b){
 if ($a['time'] == $b['time']) {
 return 0;
 }
@@ -126,7 +128,7 @@ class PostReceiveHook extends ReceiveHook
 private function sendBranchMail($name, $changeType, $oldrev, $newrev)
 {
 
-$status = [self::TYPE_UPDATED = 'Update', self::TYPE_CREATED = 
'Create', = self::TYPE_DELETED = 'Delete'];
+$status = [self::TYPE_UPDATED = 

[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/NEWS branches/PHP_5_3/ext/pdo_odbc/odbc_stmt.c branches/PHP_5_4/NEWS branches/PHP_5_4/ext/pdo_odbc/odbc_stmt.c trunk/ext/pdo_odbc/odbc_stmt.c

2012-03-14 Thread Ilia Alshanetsky
iliaaWed, 14 Mar 2012 20:20:33 +

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

Log:
Fixed bug #61212 (PDO ODBC Segfaults on SQL_SUCESS_WITH_INFO).

Bug: https://bugs.php.net/61212 (Open) PDO ODBC Segfaults on 
SQL_SUCESS_WITH_INFO
  
Changed paths:
U   php/php-src/branches/PHP_5_3/NEWS
U   php/php-src/branches/PHP_5_3/ext/pdo_odbc/odbc_stmt.c
U   php/php-src/branches/PHP_5_4/NEWS
U   php/php-src/branches/PHP_5_4/ext/pdo_odbc/odbc_stmt.c
U   php/php-src/trunk/ext/pdo_odbc/odbc_stmt.c

Modified: php/php-src/branches/PHP_5_3/NEWS
===
--- php/php-src/branches/PHP_5_3/NEWS   2012-03-14 20:08:14 UTC (rev 324250)
+++ php/php-src/branches/PHP_5_3/NEWS   2012-03-14 20:20:33 UTC (rev 324251)
@@ -47,6 +47,9 @@
   . Fixed bug #61194 (PDO should export compression flag with myslqnd).
 (Johannes)

+- PDO_odbc
+  . Fixed bug #61212 (PDO ODBC Segfaults on SQL_SUCESS_WITH_INFO). (Ilia)
+
 - PDO_pgsql
   . Fixed bug #61267 (pdo_pgsql's PDO::exec() returns the number of SELECTed
 rows on postgresql = 9). (ben dot pineau at gmail dot com)

Modified: php/php-src/branches/PHP_5_3/ext/pdo_odbc/odbc_stmt.c
===
--- php/php-src/branches/PHP_5_3/ext/pdo_odbc/odbc_stmt.c   2012-03-14 
20:08:14 UTC (rev 324250)
+++ php/php-src/branches/PHP_5_3/ext/pdo_odbc/odbc_stmt.c   2012-03-14 
20:20:33 UTC (rev 324251)
@@ -637,12 +637,14 @@

if (C-fetched_len != SQL_NO_TOTAL) {
/* use size suggested by the driver, if it 
knows it */
-   alloced = C-fetched_len + 1;
+   buf = emalloc(C-fetched_len + 1);
+   memcpy(buf, C-data, C-fetched_len);
+   buf[C-fetched_len] = 0;
+   used = C-fetched_len;
+   } else {
+   buf = estrndup(C-data, 256);
+   used = 255; /* not 256; the driver NUL 
terminated the buffer */
}
-
-   buf = emalloc(alloced);
-   memcpy(buf, C-data, 256);
-   used = 255; /* not 256; the driver NUL terminated the 
buffer */

do {
C-fetched_len = 0;

Modified: php/php-src/branches/PHP_5_4/NEWS
===
--- php/php-src/branches/PHP_5_4/NEWS   2012-03-14 20:08:14 UTC (rev 324250)
+++ php/php-src/branches/PHP_5_4/NEWS   2012-03-14 20:20:33 UTC (rev 324251)
@@ -75,6 +75,9 @@
   . Fixed bug #61194 (PDO should export compression flag with myslqnd).
 (Johannes)

+- PDO_odbc
+  . Fixed bug #61212 (PDO ODBC Segfaults on SQL_SUCESS_WITH_INFO). (Ilia)
+
 - Phar
   . Fixed bug #61184 (Phar::webPhar() generates headers with trailing NUL
 bytes). (Nikita Popov)

Modified: php/php-src/branches/PHP_5_4/ext/pdo_odbc/odbc_stmt.c
===
--- php/php-src/branches/PHP_5_4/ext/pdo_odbc/odbc_stmt.c   2012-03-14 
20:08:14 UTC (rev 324250)
+++ php/php-src/branches/PHP_5_4/ext/pdo_odbc/odbc_stmt.c   2012-03-14 
20:20:33 UTC (rev 324251)
@@ -637,12 +637,14 @@

if (C-fetched_len != SQL_NO_TOTAL) {
/* use size suggested by the driver, if it 
knows it */
-   alloced = C-fetched_len + 1;
+   buf = emalloc(C-fetched_len + 1);
+   memcpy(buf, C-data, C-fetched_len);
+   buf[C-fetched_len] = 0;
+   used = C-fetched_len;
+   } else {
+   buf = estrndup(C-data, 256);
+   used = 255; /* not 256; the driver NUL 
terminated the buffer */
}
-
-   buf = emalloc(alloced);
-   memcpy(buf, C-data, 256);
-   used = 255; /* not 256; the driver NUL terminated the 
buffer */

do {
C-fetched_len = 0;

Modified: php/php-src/trunk/ext/pdo_odbc/odbc_stmt.c
===
--- php/php-src/trunk/ext/pdo_odbc/odbc_stmt.c  2012-03-14 20:08:14 UTC (rev 
324250)
+++ php/php-src/trunk/ext/pdo_odbc/odbc_stmt.c  2012-03-14 20:20:33 UTC (rev 
324251)
@@ -637,12 +637,14 @@

if (C-fetched_len != SQL_NO_TOTAL) {
/* use size suggested by the driver, if it 
knows it */
-   alloced = C-fetched_len + 1;
+   buf = emalloc(C-fetched_len + 1);
+