summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/apache/apconf-conv.sh24
-rwxr-xr-xscripts/apache/aphtaccess-conv.sh24
-rw-r--r--scripts/apache/conffix.awk23
-rw-r--r--scripts/apache/htaccessfix.awk23
-rw-r--r--scripts/dev/check_parameters.php132
-rwxr-xr-xscripts/dev/credits6
-rw-r--r--scripts/dev/find_tested.php12
-rwxr-xr-xscripts/dev/gen_verify_stub51
-rw-r--r--scripts/dev/generate-phpt.pharbin52356 -> 52356 bytes
-rwxr-xr-xscripts/dev/search_underscores.php2
-rw-r--r--scripts/phpize.m42
11 files changed, 135 insertions, 164 deletions
diff --git a/scripts/apache/apconf-conv.sh b/scripts/apache/apconf-conv.sh
deleted file mode 100755
index 6126bdc27d..0000000000
--- a/scripts/apache/apconf-conv.sh
+++ /dev/null
@@ -1,24 +0,0 @@
-#!/bin/sh
-
-if [ "$1" = "" ]; then
- echo "Usage: $0 /somewhere/httpd.conf"
- exit 1
-fi
-
-if [ ! -w $1 ]; then
- echo "You cannot write to $1"
- exit 1
-fi
-
-TMPFILE=tmpfile.$$
-
-awk -f conffix.awk <$1 >$TMPFILE
-
-if [ "$?" != 0 ]; then
- exit 1
-fi
-
-mv -f $1 $1.orig
-mv -f $TMPFILE $1
-exit 0
-
diff --git a/scripts/apache/aphtaccess-conv.sh b/scripts/apache/aphtaccess-conv.sh
deleted file mode 100755
index 1af59d2843..0000000000
--- a/scripts/apache/aphtaccess-conv.sh
+++ /dev/null
@@ -1,24 +0,0 @@
-#!/bin/sh
-
-if [ "$1" = "" ]; then
- echo "Usage: $0 /somewhere/.htaccess"
- exit 1
-fi
-
-if [ ! -w $1 ]; then
- echo "You cannot write to $1"
- exit 1
-fi
-
-TMPFILE=tmpfile.$$
-
-awk -f htaccessfix.awk <$1 >$TMPFILE
-
-if [ "$?" != 0 ]; then
- exit 1
-fi
-
-mv -f $1 $1.orig
-mv -f $TMPFILE $1
-exit 0
-
diff --git a/scripts/apache/conffix.awk b/scripts/apache/conffix.awk
deleted file mode 100644
index 88be6fade7..0000000000
--- a/scripts/apache/conffix.awk
+++ /dev/null
@@ -1,23 +0,0 @@
-# $Id$
-
-/^[ \t]*php3_*/ {
- phpcommand=substr($1,6)
- phpvalue=tolower($2)
- print "<IfModule mod_php3.c>"
- print $0
- print "</IfModule>"
- print "<IfModule mod_php4.c>"
- if (phpvalue=="on") {
- print "php_admin_flag " phpcommand " on"
- } else if (phpvalue=="off") {
- print "php_admin_flag " phpcommand " off"
- } else {
- print "php_admin_value " phpcommand " " substr($0,index($0,$1)+length($1)+1)
- }
- print "</IfModule>"
-}
-
-! /^[ \t]*php3_*/ {
- print $0
-}
-
diff --git a/scripts/apache/htaccessfix.awk b/scripts/apache/htaccessfix.awk
deleted file mode 100644
index 3c784cd335..0000000000
--- a/scripts/apache/htaccessfix.awk
+++ /dev/null
@@ -1,23 +0,0 @@
-# $Id$
-
-/^[ \t]*php3_*/ {
- phpcommand=substr($1,6)
- phpvalue=tolower($2)
- print "<IfModule mod_php3.c>"
- print $0
- print "</IfModule>"
- print "<IfModule mod_php4.c>"
- if (phpvalue=="on") {
- print "php_flag " phpcommand " on"
- } else if (phpvalue=="off") {
- print "php_flag " phpcommand " off"
- } else {
- print "php_value " phpcommand " " substr($0,index($0,$1)+length($1)+1)
- }
- print "</IfModule>"
-}
-
-! /^[ \t]*php3_*/ {
- print $0
-}
-
diff --git a/scripts/dev/check_parameters.php b/scripts/dev/check_parameters.php
index c9f5169eec..0f157a794c 100644
--- a/scripts/dev/check_parameters.php
+++ b/scripts/dev/check_parameters.php
@@ -1,7 +1,7 @@
<?php
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2007 The PHP Group |
+----------------------------------------------------------------------+
@@ -20,8 +20,8 @@
/* $Id$ */
-define('REPORT_LEVEL', 2); // 0 reports less false-positives. up to level 5.
-define('VERSION', '5.2'); // minimum is 5.2
+define('REPORT_LEVEL', 1); // 0 reports less false-positives. up to level 5.
+define('VERSION', '7.0'); // minimum is 7.0
define('PHPDIR', realpath(dirname(__FILE__) . '/../..'));
@@ -33,31 +33,25 @@ ini_set('pcre.backtrack_limit', 10000000);
$API_params = array(
- 'a' => array('zval**'), // array as zval*
+ 'a' => array('zval**'), // array
+ 'A' => array('zval**'), // array or object
'b' => array('zend_bool*'), // boolean
- 'C' => array('zend_class_entry**'), // class
'd' => array('double*'), // double
'f' => array('zend_fcall_info*', 'zend_fcall_info_cache*'), // function
'h' => array('HashTable**'), // array as an HashTable*
- 'l' => array('long*'), // long
+ 'H' => array('HashTable**'), // array or HASH_OF(object)
+ 'l' => array('zend_long*'), // long
+ //TODO 'L' => array('zend_long*, '), // long
'o' => array('zval**'), //object
'O' => array('zval**', 'zend_class_entry*'), // object of given type
+ 'P' => array('zend_string**'), // valid path
'r' => array('zval**'), // resource
- 's' => array('char**', 'int*'), // string
+ 'S' => array('zend_string**'), // string
'z' => array('zval**'), // zval*
'Z' => array('zval***') // zval**
+ // 's', 'p', 'C' handled separately
);
-// specific to PHP >= 6
-if (version_compare(VERSION, '6', 'ge')) {
- $API_params['S'] = $API_params['s']; // binary string
- $API_params['t'] = array('zstr*', 'int*', 'zend_uchar*'); // text
- $API_params['T'] = $API_params['t'];
- $API_params['u'] = array('UChar**', 'int*'); // unicode
- $API_params['U'] = $API_params['u'];
-}
-
-
/** reports an error, according to its level */
function error($str, $level = 0)
{
@@ -65,7 +59,7 @@ function error($str, $level = 0)
if ($level <= REPORT_LEVEL) {
if (strpos($current_file,PHPDIR) === 0) {
- $filename = substr($current_file, strlen(PHPDIR)+1);
+ $filename = substr($current_file, strlen(PHPDIR)+1);
} else {
$filename = $current_file;
}
@@ -135,7 +129,7 @@ function get_vars($txt)
/** run diagnostic checks against one var. */
-function check_param($db, $idx, $exp, $optional)
+function check_param($db, $idx, $exp, $optional, $allow_uninit = false)
{
global $error_few_vars_given;
@@ -153,15 +147,14 @@ function check_param($db, $idx, $exp, $optional)
error("{$db[$idx][0]}: expected '$exp' but got '{$db[$idx][1]}' [".($idx+1).']');
}
- if ($optional && !$db[$idx][2]) {
- error("optional var not initialized: {$db[$idx][0]} [".($idx+1).']', 1);
-
- } elseif (!$optional && $db[$idx][2]) {
+ if (!$optional && $db[$idx][2]) {
error("not optional var is initialized: {$db[$idx][0]} [".($idx+1).']', 2);
}
+ if (!$allow_uninit && $optional && !$db[$idx][2]) {
+ error("optional var not initialized: {$db[$idx][0]} [".($idx+1).']', 1);
+ }
}
-
/** fetch params passed to zend_parse_params*() */
function get_params($vars, $str)
{
@@ -200,7 +193,15 @@ function check_function($name, $txt, $offset)
{
global $API_params;
- if (preg_match_all('/zend_parse_parameters(?:_ex\s*\([^,]+,[^,]+|\s*\([^,]+),\s*"([^"]*)"\s*,\s*([^{;]*)/S', $txt, $matches, PREG_SET_ORDER | PREG_OFFSET_CAPTURE)) {
+ $regex = '/
+ (?: zend_parse_parameters(?:_throw)? \s*\([^,]+
+ | zend_parse_(?:parameters_ex|method_parameters) \s*\([^,]+,[^,]+
+ | zend_parse_method_parameters_ex \s*\([^,]+,[^,]+,[^,+]
+ )
+ ,\s*"([^"]*)"\s*
+ ,\s*([^{;]*)
+ /Sx';
+ if (preg_match_all($regex, $txt, $matches, PREG_SET_ORDER | PREG_OFFSET_CAPTURE)) {
$GLOBALS['current_function'] = $name;
@@ -211,12 +212,14 @@ function check_function($name, $txt, $offset)
$vars = get_vars(substr($txt, 0, $m[0][1])); // limit var search to current location
$params = get_params($vars, $m[2][0]);
$optional = $varargs = false;
- $last_last_char = $last_char = '';
+ $last_char = '';
$j = -1;
- $len = strlen($m[1][0]);
+ $spec = $m[1][0];
+ $len = strlen($spec);
for ($i = 0; $i < $len; ++$i) {
- switch($char = $m[1][0][$i]) {
+ $char = $spec[$i];
+ switch ($char = $spec[$i]) {
// separator for optional parameters
case '|':
if ($optional) {
@@ -231,57 +234,60 @@ function check_function($name, $txt, $offset)
// separate_zval_if_not_ref
case '/':
- if (!in_array($last_char, array('r', 'z'))) {
- error("the '/' specifier cannot be applied to '$last_char'");
+ if (in_array($last_char, array('l', 'L', 'd', 'b'))) {
+ error("the '/' specifier should not be applied to '$last_char'");
}
break;
// nullable arguments
case '!':
- if (!in_array($last_char, array('a', 'C', 'f', 'h', 'o', 'O', 'r', 's', 't', 'z', 'Z'))) {
- error("the '!' specifier cannot be applied to '$last_char'");
+ if (in_array($last_char, array('l', 'L', 'd', 'b'))) {
+ check_param($params, ++$j, 'zend_bool*', $optional);
}
break;
- case '&':
- if (version_compare(VERSION, '6', 'ge')) {
- if ($last_char == 's' || ($last_last_char == 's' && $last_char == '!')) {
- check_param($params, ++$j, 'UConverter*', $optional);
-
- } else {
- error("the '&' specifier cannot be applied to '$last_char'");
- }
+ // variadic arguments
+ case '+':
+ case '*':
+ if ($varargs) {
+ error("A varargs specifier can only be used once. repeated char at column $i");
} else {
- error("unknown char ('&') at column $i");
+ check_param($params, ++$j, 'zval**', $optional);
+ check_param($params, ++$j, 'int*', $optional);
+ $varargs = true;
}
break;
- case '+':
- case '*':
- if (version_compare(VERSION, '6', 'ge')) {
- if ($varargs) {
- error("A varargs specifier can only be used once. repeated char at column $i");
- } else {
- check_param($params, ++$j, 'zval****', $optional);
- check_param($params, ++$j, 'int*', $optional);
- $varargs = true;
- }
- } else {
- error("unknown char ('$char') at column $i");
+ case 's':
+ case 'p':
+ check_param($params, ++$j, 'char**', $optional, $allow_uninit=true);
+ check_param($params, ++$j, 'size_t*', $optional, $allow_uninit=true);
+ if ($optional && !$params[$j-1][2] && !$params[$j][2]
+ && $params[$j-1][0] !== '**dummy**' && $params[$j][0] !== '**dummy**') {
+ error("one of optional vars {$params[$j-1][0]} or {$params[$j][0]} must be initialized", 1);
}
break;
+ case 'C':
+ // C must always be initialized, independently of whether it's optional
+ check_param($params, ++$j, 'zend_class_entry**', false);
+ break;
+
default:
- if (isset($API_params[$char])) {
- foreach($API_params[$char] as $exp) {
- check_param($params, ++$j, $exp, $optional);
- }
- } else {
+ if (!isset($API_params[$char])) {
error("unknown char ('$char') at column $i");
}
+
+ // If an is_null flag is in use, only that flag is required to be
+ // initialized
+ $allow_uninit = $i+1 < $len && $spec[$i+1] === '!'
+ && in_array($char, array('l', 'L', 'd', 'b'));
+
+ foreach ($API_params[$char] as $exp) {
+ check_param($params, ++$j, $exp, $optional, $allow_uninit);
+ }
}
- $last_last_char = $last_char;
$last_char = $char;
}
}
@@ -306,8 +312,10 @@ function recurse($path)
$txt = file_get_contents($file);
// remove comments (but preserve the number of lines)
- $txt = preg_replace(array('@//.*@S', '@/\*.*\*/@SsUe'), array('', 'preg_replace("/[^\r\n]+/S", "", \'$0\')'), $txt);
-
+ $txt = preg_replace('@//.*@S', '', $txt);
+ $txt = preg_replace_callback('@/\*.*\*/@SsU', function($matches) {
+ return preg_replace("/[^\r\n]+/S", "", $matches[0]);
+ }, $txt);
$split = preg_split('/PHP_(?:NAMED_)?(?:FUNCTION|METHOD)\s*\((\w+(?:,\s*\w+)?)\)/S', $txt, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_OFFSET_CAPTURE);
@@ -352,7 +360,7 @@ HELP;
for ($i = 1; $i < $argc; $i++) {
$dirs[] = $argv[$i];
}
-} else {
+} else {
$dirs[] = PHPDIR;
}
diff --git a/scripts/dev/credits b/scripts/dev/credits
index 801637cd19..5be84fda07 100755
--- a/scripts/dev/credits
+++ b/scripts/dev/credits
@@ -10,9 +10,9 @@ do
/*
DO NOT EDIT THIS FILE!
- it has been automaticaly created by php5/scripts/credits from
- the information found in the various php5/ext/.../CREDITS and
- php5/sapi/.../CREDITS files
+ it has been automaticaly created by php7/scripts/credits from
+ the information found in the various php7/ext/.../CREDITS and
+ php7/sapi/.../CREDITS files
if you want to change an entry you have to edit the appropriate
CREDITS file instead
diff --git a/scripts/dev/find_tested.php b/scripts/dev/find_tested.php
index e841e2e959..0881e9ea47 100644
--- a/scripts/dev/find_tested.php
+++ b/scripts/dev/find_tested.php
@@ -68,7 +68,10 @@ get_phpt_files($extension_test_path, $count, $phpt_files);
$extension_method_info = mark_methods_as_tested($extension_method_info, $phpt_files);
-
+/**
+ * The loop to ouput the test coverage info
+ * Should output: Extension, Class Name, Method/Function Name, Test Status, Test Files
+ */
foreach($extension_method_info as $record) {
echo $record[EXTENSION_NAME] . ",";
echo $record[CLASS_NAME] . ",";
@@ -193,11 +196,14 @@ function get_phpt_files($dir, &$phpt_file_count, &$all_phpt)
}
}
-function extract_tests($file) {
+/**
+ * Extract tests from a specified file, returns an array of tested function tokens
+ */
+function extract_tests($file) {
$code = file_get_contents($file);
if (!preg_match('/--FILE--\s*(.*)\s*--(EXPECTF|EXPECTREGEX|EXPECT)?--/is', $code, $r)) {
-// print "Unable to get code in ".$file."\n";
+ //print "Unable to get code in ".$file."\n";
return array();
}
diff --git a/scripts/dev/gen_verify_stub b/scripts/dev/gen_verify_stub
new file mode 100755
index 0000000000..4d07a9dcb8
--- /dev/null
+++ b/scripts/dev/gen_verify_stub
@@ -0,0 +1,51 @@
+#!/bin/bash
+
+if [ "x$1" == "x" ]
+then
+ echo "Usage: $0 <version> [email]"
+ echo "Generate the tarball verification info suitable to put into an announcement."
+ echo
+ echo "Examples"
+ echo " $0 7.0.0beta3"
+ exit 0
+fi
+
+RELEASE_VER=$1
+
+GPG_USER=
+if [ "x$2" != "x" ]
+then
+ GPG_USER=$2
+fi
+
+if test "x$PHPROOT" == "x"; then
+ PHPROOT=.
+fi
+
+for TARBALL in "$PHPROOT/php-$RELEASE_VER.tar.bz2" "$PHPROOT/php-$RELEASE_VER.tar.gz" "$PHPROOT/php-$RELEASE_VER.tar.xz"
+do
+ if ! [ -e $TARBALL ]
+ then
+ echo "$TARBALL doesn't exist"
+ exit 3
+ fi
+
+ if [ -n $GPG_USER ]
+ then
+ gpg --armor --detach-sign $TARBALL
+ else
+ gpg -u $GPG_USER --armor --detach-sign $TARBALL
+ fi
+done
+
+for TARBALL in "$PHPROOT/php-$RELEASE_VER.tar.bz2" "$PHPROOT/php-$RELEASE_VER.tar.gz" "$PHPROOT/php-$RELEASE_VER.tar.xz"
+do
+ basename $TARBALL
+ echo "SHA256 hash: `sha256sum $TARBALL | cut -d' ' -f1`";
+ echo PGP signature:
+ cat $TARBALL.asc
+ echo -e "\n"
+done
+
+exit 0
+
diff --git a/scripts/dev/generate-phpt.phar b/scripts/dev/generate-phpt.phar
index c6268c0af3..3b2137ade6 100644
--- a/scripts/dev/generate-phpt.phar
+++ b/scripts/dev/generate-phpt.phar
Binary files differ
diff --git a/scripts/dev/search_underscores.php b/scripts/dev/search_underscores.php
index 445228b8c5..67ed02f160 100755
--- a/scripts/dev/search_underscores.php
+++ b/scripts/dev/search_underscores.php
@@ -3,7 +3,7 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2006 The PHP Group |
+----------------------------------------------------------------------+
diff --git a/scripts/phpize.m4 b/scripts/phpize.m4
index d745ca7443..d5f5f476ec 100644
--- a/scripts/phpize.m4
+++ b/scripts/phpize.m4
@@ -93,7 +93,7 @@ php_zts_is_enabled
PHP_THREAD_SAFETY=no
])
CPPFLAGS=$old_CPPFLAGS
-AC_MSG_RESULT([$PHP_DEBUG])
+AC_MSG_RESULT([$PHP_THREAD_SAFETY])
dnl Support for building and testing Zend extensions
ZEND_EXT_TYPE="zend_extension"