Compare commits

..
191 Commits
Author SHA1 Message Date
Derick Rethans 197a7083df Update versions for PHP 7.4.18 2021-04-27 14:35:40 +00:00
Derick Rethans 13389613fa Update NEWS for PHP 7.4.18 2021-04-27 14:35:40 +00:00
Derick Rethans f98f4875df Prepare for 7.4.18 2021-04-27 15:33:01 +01:00
Christoph M. Becker b1680c5fe3 Fix #80710: imap_mail_compose() header injection
Like `mail()` and `mb_send_mail()`, `imap_mail_compose()` must prevent
header injection.  For maximum backward compatibility, we still allow
header folding for general headers, and still accept trailing line
breaks for address lists.
2021-04-27 15:29:59 +01:00
Derick Rethans 8cb114413f Put back inadvertedly removed NEWS entries 2021-04-13 11:49:36 +01:00
Derick Rethans 1e0f53278d Update NEWS for PHP 7.4.18RC1 2021-04-13 10:24:25 +00:00
Derick Rethans d4f7e8cedc Prepare NEWS for 7.4.18RC1 2021-04-13 10:00:45 +01:00
Nikita Popov a1fdfa700b Fixed bug #80950
Function info for curl_exec() incorrect specified that the
function cannot return true. This is already fixed in PHP 8,
as the func info entry was removed there.
2021-04-12 16:05:37 +02:00
Christoph M. Becker 0a36d417e8 Fix #79812: Potential integer overflow in pcntl_exec()
We use the proper type, and make sure that no overflow can occur by
using `safe_emalloc()` (we can assume that neither string length is
`SIZE_MAX`).

Closes GH-6845.
2021-04-12 12:12:40 +02:00
David Carlier a04fac84e7 Disable ifunc support on openbsd
Enabling it leads to segfault when resolvers are used e.g.
php_stripslashes.

Closes GH-6851.
2021-04-12 11:27:50 +02:00
fishmore 600402d986 Update zend_alloc.c
Don't free main thunk.  It will crash.
2021-04-12 09:28:24 +03:00
Matteo Beccati 340a06778c Fix #80892: PDO::PARAM_INT is treated the same as PDO::PARAM_STR 2021-04-12 08:03:07 +02:00
Matteo Beccati da3a807f22 Increased test compatibility
The test expects no masked signals at the beginning, but when run as part
of a Bamboo build, SIGQUIT is already masked and the test fails.
2021-04-11 17:19:58 +02:00
Nikita Popov 454d297564 Fix gidlist allocation leak on error 2021-04-11 10:37:40 +02:00
Dmitry Stogov 7a8ffcec7d Fixed type inference for OP_DATA 2021-04-09 14:52:55 +03:00
Nikita Popov 29fa4d203a Don't mark non-refcounted phi as live
If the value is not refcounted, then it doesn't matter if the
FREE gets dropped.
2021-04-08 18:20:09 +02:00
Nikita Popov 0826a54836 Fix DCE of FREE of COALESCE
When encountering the following SSA graph:

    BB1:
    #2.T1 [string] = COALESCE #1.CV0($str) [null, string] BB2

    BB2:
    #5.T1 [string] = QM_ASSIGN string("")

    BB3:
    #7.X1 [string] = Phi(#2.X1 [string], #5.X1 [string])
    FREE #7.T1 [string]

We would currently determine that #7, #5 are dead, and eliminate
the FREE and QM_ASSIGN. However, we cannot eliminate #2, as
COALESCE is also responsible for control flow.

Fix this my marking all non-CV phis as live to start with. This
can be relaxed to check the kind of the source instruction, but
I couldn't immediately come up with a case where it would be
useful.
2021-04-08 17:01:13 +02:00
Remi Collet 25f5a1b2e1 Improve fix for #80783 2021-04-08 15:28:03 +02:00
Nikita Popov eebcfeb68e Support more than NGROUPS_MAX groups on macos
I suspect this is the cause for our recent CI failures. Apparently,
on macos it is possible for getgroups() to return more than
NGROUPS_MAX groups. We avoid an EINVAL in that case by fetching
the exact number of groups in advance. This should work on both
macos and posix systems.
2021-04-08 12:23:39 +02:00
Christoph M. Becker 0a181ca27a Update version in main/php_version.h as well
Otherwise the file is modified by each new build, what is confusing.
2021-04-07 12:45:21 +02:00
Christoph M. Becker 9688071679 Fix #80880: SSL_read on shutdown, ftp/proc_open
When `SSL_read()` after `SSL_shutdown()` fails with `SSL_ERROR_SYSCALL`,
we should not warn about this, because it is likely caused by the peer
having closed the connection without having sent a close_notify
shutdown alert.

Signed-off-by: Christoph M. Becker <cmbecker69@gmx.de>

Closes GH-6803.
2021-04-06 14:03:19 +02:00
Dylan K. Taylor 50f476591f .gdbinit: make zbacktrace show the correct stack when switching threads
I found this mainly to be a problem when working with threading
extensions. zbacktrace doesn't show the correct stack when switching
threads.

Closes GH-6814.
2021-04-05 21:10:52 +02:00
Dmitry Stogov 39d8fc1edc Changed PowerPC CPU registers used by Zend VM to work around GCC bug.
Old registers (r28/r29) might be clobbered by _restgpr routine used for return from C function compiled with -Os.
2021-03-31 13:10:21 +03:00
Rowan Tommins 206fd35a98 Handle reference zvals when outputting superglobals in phpinfo()
Fixes <https://bugs.php.net/80915>.

Closes GH-80915.

Signed-off-by: Christoph M. Becker <cmbecker69@gmx.de>
2021-03-30 13:49:22 +02:00
Christoph M. Becker 75cb678206 Fix #69668: SOAP special XML characters in namespace URIs not encoded
`xmlNewNs()` does not XML encode the passed `href`, so we need to do
that manually.

Closes GH-6804.

Signed-off-by: Christoph M. Becker <cmbecker69@gmx.de>
2021-03-29 14:17:55 +02:00
Christoph M. Becker 498eb8e052 Fix #73533: Invalid memory access in php_libxml_xmlCheckUTF8
A string passed to `php_libxml_xmlCheckUTF8()` may be longer than
1<<31-1 bytes, so we're better using a `size_t`.

Closes GH-6802.
2021-03-24 11:50:50 +01:00
Christoph M. Becker 688e56d0ac Properly initialize PS(mod) on RINIT
We need to do that in case a user handler has been set.  However, we
can't do that in `php_rinit_session_globals()` since that function is
called by PHP function `session_destroy()` too, but in that case we
don't want to reset PS(mod).

Closes GH-6795.
2021-03-23 13:12:19 +01:00
Christoph M. Becker 838951c2d6 Fix #80889: amendment
`session_set_save_handler()` may be called with callables instead of an
object; we need to cater to that as well.

We also extract a set_user_save_handler_ini() function to avoid code
duplication.

Closes GH-6796.
2021-03-22 22:17:35 +01:00
Jakub Zelenka bc7ea73da5 Use ServerClientTestCase in a test for default_socket_timeout=-1 2021-03-21 21:19:40 +00:00
Jakub Zelenka 538f95b1b7 Fix NEWS entry position for the latest FPM fix 2021-03-21 18:58:57 +00:00
Jakub Zelenka c483b59124 Fix bug #80024: Duplication of info about inherited socket after pool removing 2021-03-21 18:52:07 +00:00
Christoph M. Becker 06bfada99b Fix #80889: Cannot set save handler when save_handler is invalid
There is no need to require a (valid) save_handler to be set, when a
user handler is supposed to be set.  We just have to make sure, that
no user handler is already set in this case.

Closes GH-6788.
2021-03-19 16:59:54 +01:00
Christoph M. Becker bccca0b53a Fix #80783: PDO ODBC truncates BLOB records at every 256th byte
It is not guaranteed, that the driver inserts only a single NUL byte at
the end of the buffer.  Apparently, there is no way to find out the
actual data length in the buffer after calling `SQLGetData()`, so we
adjust after the next `SQLGetData()` call.

We also prevent PDO::ODBC_ATTR_ASSUME_UTF8 from fetching garbage, by
fetching all chunks with the same C type.

Closes GH-6716.
2021-03-18 15:13:27 +01:00
Nikita Popov 4be867e910 Fix locale switch back to C in pcre
The compile context is shared between patterns, so we need to set
the character tables unconditionally in case we switched from
a non-C locale to the C locale.
2021-03-18 10:48:43 +01:00
Christoph M. Becker a08847ab39 Fix #66783: UAF when appending DOMDocument to element
According to the DOM standard, elements may only contain element, text,
processing instruction and comment nodes[1].  It is also specified that
a HierarchyRequestError should be thrown if a document is to be
inserted[2].  We follow that standard, and prevent the use-after-free
this way.

[1] <https://dom.spec.whatwg.org/#node-trees>
[2] <https://dom.spec.whatwg.org/#mutation-algorithms>

Closes GH-6765.
2021-03-17 12:37:18 +01:00
Derick Rethans 4adc08a403 Fix build version too 2021-03-16 09:41:21 +00:00
Derick Rethans 5e4ee3d0bd NEWS for 7.4.18 2021-03-16 09:40:05 +00:00
Derick Rethans eb1d1fe373 Prepare for 7.4.17RC1 2021-03-16 09:33:33 +00:00
Christoph M. Becker f448b0e6dd Fix #80817: dba_popen() may cause segfault during RSHUTDOWN
We need to close persistent streams with the proper flag.
2021-03-15 18:37:44 +01:00
Dharman 282355efd5 Fix bug #80866
Closes GH-6774.
2021-03-15 14:47:45 +01:00
Dharman c93b461ad7 Fix bug #80837
The error needs to be reported on the statement, not the connection.
2021-03-15 14:38:09 +01:00
Nikita Popov fc4cd598a2 Update ubuntu on i386 job
There is a failure with apt on PHP-7.4 that's not present on
PHP-8.0/master. Switching to a newer ubuntu version on PHP-7.4
avoids the issue.
2021-03-15 14:11:19 +01:00
Nikita Popov 703bbf5210 Downgrade security level in tests using TLS < 1.2
A few additional tests have been added on master that require
lower security level.

(cherry picked from commit c2a6395dcb)
2021-03-15 14:11:12 +01:00
Christoph M. BeckerandMichael Wallner f901bec494 Fix #51903: simplexml_load_file() doesn't use HTTP headers
The `encoding` attribute of the XML declaration is optional; it is good
practice to use external encoding information where available if it is
missing.  Thus, we check for `charset` info of `Content-Type` headers,
and see whether the encoding is supported.

We cater to trailing parameters and quoted-strings, but not to escaped
backslashes and quotes in quoted-strings, since no known character
encoding contains these anyway.

Co-authored-by: Michael Wallner <mike@php.net>

Closes GH-6747.
2021-03-08 15:07:01 +01:00
manuel 5787f91c55 Fix #80838: HTTP wrapper waits for HTTP 1 response after HTTP 101
Don't wait for further responses after a HTTP 101 (Switching Protocols) response

Closes GH-6730.
2021-03-08 14:36:31 +01:00
George Wang 8fc0bdfb0a Merge branch 'PHP-7.4' of git.php.net:php-src into PHP-7.4 2021-03-05 10:57:46 -05:00
George Wang 797edd6211 LiteSpeed SAPI v7.9: Process manager keeps forked child process alive for longer time based on load. Reduces PM overhead for busy setup. 2021-03-05 10:46:12 -05:00
Christoph M. Becker e0e167e581 Print error code if CreateMutex() fails
This issue came up recently in a bug report[1]; without the error code,
users can barely guess why the function failed.

[1] <https://bugs.php.net/80812>

Closes GH-6745.
2021-03-05 15:06:18 +01:00
Christoph M. Becker 51e2015af3 Fix #78719: http wrapper silently ignores long Location headers
When opening HTTP streams, and reading the headers, we currently
discard header lines longer than `HTTP_HEADER_BLOCK_SIZE` (1024 bytes).
While this is not generally forbidden by RFC 7230, section 3.2.5, it
is not generally allowed either, since that may change the "message
framing or response semantics".

We thus fix this by allowing arbitrarily long header lines.

Closes GH-6720.
2021-03-03 10:45:25 +01:00
Christoph M. BeckerandNikita Popov 71297a254b Fix #80751: Comma in recipient name breaks email delivery
So far, `SendText()` simply separates potential email address lists at
any comma, disregarding that commas inside a quoted-string do not
delimit addresses.  We fix that by introducing an own variant of
`strtok_r()` which caters to quoted-strings.

We also make `FormatEmailAddress()` aware of quoted strings.

We do not cater to email address comments, and potentially other quirks
of RFC 5322 email addresses, but catering to quoted-strings is supposed
to solve almost all practical use cases.

Co-authored-by: Nikita Popov <nikita.ppv@gmail.com>

Closes GH-6735.
2021-03-01 18:46:21 +01:00
Nikita Popov 2c508c4d40 Always remove HT iterators, even for uninit HT
Fixes oss-fuzz #31423.
2021-03-01 16:22:11 +01:00
Nikita Popov e857936518 Fixed bug #80805
Handle missing result_var in binary_op_result_type.

(cherry picked from commit 8446e28275)
2021-03-01 15:13:15 +01:00
Felipe Pena 988c3f9659 Fix memleak on ReflectionFunction and ReflectionGenerator classes when calling __construct after instantiation 2021-02-25 20:53:14 +00:00
Remi Collet ae0585c98e skip test with openssl < 1.1.0
The test fails, but without any crash
(this test is designed to catch a crash)
2021-02-25 13:52:35 +01:00
Dylan K. Taylor a480bf8093 Capture Microsoft-defined HRESULT exit codes exit codes
The lack of such a check leads to false-passes of tests on Windows
which expect no output, but produce a segfault or similar issue. I
discovered this a while ago due to bad tests in an extension I maintain.

Closes GH-6722.
2021-02-25 12:01:04 +01:00
Daniel Black 8309c04464 mysqlnd pam fix test error message
Closes GH-6727.
2021-02-25 09:51:51 +01:00
Nikita Popov 766f827e26 Fix potential file collision in dom tests 2021-02-24 21:30:20 +01:00
Felipe Pena 3ec37a74a2 Fix bug #80757 (Exit code is 0 when could not open file) 2021-02-24 18:50:27 +00:00
Felipe Pena 78b0a85de6 Update NEWS 2021-02-24 18:40:32 +00:00
Christoph M. Becker 67bb06cc9b Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  run-tests: fixed exit code not being set on BORKED tests
2021-02-23 13:15:30 +01:00
Dylan K. Taylor 729cd8bacd run-tests: fixed exit code not being set on BORKED tests
When no test paths are specified this shows up when 'make test' is used on a PECL extension without specifying tests to run (or in php-src too, I guess...)

Closes GH-6717.
2021-02-23 12:50:03 +01:00
Christoph M. Becker 81396ea890 Update php_version.h to proper version number 2021-02-23 12:09:06 +01:00
Christoph M. Becker 963e50c8c4 Fix #75776: Flushing streams with compression filter is broken
First, the `bzip2.compress` filter has the same issue as `zlib.deflate`
so we port the respective fix[1] to ext/bz2.

Second, there is still an issue, if a stream with an attached
compression filter is flushed before it is closed, without any writes
in between.  In that case, the compression is never finalized.  We fix
this by enforcing a `_php_stream_flush()` with the `closing` flag set
in `_php_stream_free()`, whenever a write filter is attached.  This
call is superfluous for most write filters, but does not hurt, even
when it is unnecessary.

[1] <http://git.php.net/?p=php-src.git;a=commit;h=20e75329f2adb11dd231852c061926d0e4080929>

Closes GH-6703.
2021-02-22 15:28:46 +01:00
Christoph M. Becker 073b6ea818 Fix #80771: phpinfo(INFO_CREDITS) displays nothing in CLI
There is no good reason not to show the credits in text based SAPIs,
except for brevity.  Thus, we suppress the credits from `php -i`.

Closes GH-6710.
2021-02-22 14:31:51 +01:00
Christoph M. Becker d7c98ca1ac Fix #80774: session_name() problem with backslash
Since we do no longer URL decode cookie names[1], we must not URL
encode the session name.  We need to prevent broken Set-Cookie headers,
by rejecting names which contain invalid characters.

[1] <http://git.php.net/?p=php-src.git;a=commit;h=6559fe912661ca5ce5f0eeeb591d928451428ed0>

Closes GH-6711.
2021-02-22 12:32:56 +01:00
Nikita Popov 6dd85f83f7 Fixed bug #80781
zend_find_array_dim_slow() may throw, make sure to handle this.
This backports the code we already use for this on PHP-8.0,
and also backports an exception check that makes this easier to
catch.
2021-02-22 09:36:43 +01:00
Christoph M. Becker 84b6152842 Fix #80763: msgfmt_format() does not accept DateTime references
`intl_zval_to_millis()` needs to cater to references.

Closes GH-6707.
2021-02-17 17:26:48 +01:00
Nikita Popov 9552cf6b84 Handle incomplete result set metadata more gracefully
Rather than segfaulting because sname is missing lateron, report
a FAIL here. As this indicates a server bug, the errors is reported
as an out of band warning, rather than a client error.

This fixes the PHP side of bug #80713.
2021-02-16 15:34:14 +01:00
Derick Rethans 2d858fbfb1 Fixed dates 2021-02-16 11:31:34 +00:00
Derick Rethans 6d3d9104e6 PHP-7.4 is now 7.4.17-dev 2021-02-16 11:26:47 +00:00
Nikita Popov 7566742754 Suppress OpenSSL error on missing optional config
openssl_pkey_new() fetches various options from the config file --
most of these are optional, and not specifying them is not an error
condition from the perspective of the user. Unfortunately, the
CONF_get_string() API pushes an error when accessing a key that
doesn't exist (_CONF_get_string does not, but that is presumably a
private API). This commit adds a helper php_openssl_conf_get_string()
that automatically clears the error in this case. I've found that
OpenSSL occasionally does the same thing internally:
https://github.com/openssl/openssl/blob/22040fb790c854cefb04bed98ed38ea6357daf83/apps/req.c#L515-L517

Closes GH-6699.
2021-02-16 10:11:00 +01:00
Nikita Popov 64b1085464 Fixed bug #80747
If RSA key generation fails, actually report that failure.
2021-02-15 15:34:01 +01:00
Nikita Popov 7b7d99839c Fix symtable cache being used while cleaning symtable
We need to first clean the symtable and then check whether a cache
slot is available for it. Otherwise, it may happen that a destructor
runs while cleaning the table and uses up all the remaining slots
in the cache.

This is particularly insidious because once we overflow the cache,
the first pointer we modify is symtable_cache_ptr, making it hard
to understand what happened after the fact.

Fixes oss-fuzz #30815.
2021-02-15 14:58:38 +01:00
Daniel Black 3646604203 Fix #78680: mysqlnd pam plugin missing terminating null
The PAM service requires the terminating null to be part
of the communication.

Tested with MariaDB-10.4(pam) and Percona Server 5.7.32(auth_pam_compat).

Also changed MySQL Enterprise test to the server side plugin, authentication_pam
as opposed to the client plugin mysql_clear_password.

Add additional check for pamtest user and pam service file as
all are required for the test.

More importantly, test result should actually succeed.

Thanks Geoff Montee for bug report.

Closes GH-78680.
2021-02-15 11:32:07 +01:00
Nikita Popov 44a80b64b9 Fix leak when breaking out of FilesystemIterator
We need to always destroy current, not just when iter.data is not
set.

Take this opportunity to clean up the iterator destructor code a
bit, to remove redundant checks and incorrect comments.
2021-02-15 10:37:59 +01:00
Nikita Popov c34c523467 Fixed bug #80719 2021-02-11 16:12:06 +01:00
Christoph M. Becker 4f508003a9 Avoid C4090 level 1 warning
This breaks the build for PHP 8 by default.
2021-02-08 23:11:37 +01:00
Christoph M. Becker 03713ace23 Fix locale dependent parsing of PostgreSQL version number
Version numbers are not supposed to be localized, so we must not apply
locale dependent parsing with `atof()`.

Using `php_version_compare()` might even be better.

Closes GH-6668.
2021-02-08 18:57:08 +01:00
Christoph M. Becker ca7547c9e2 Fix #80706: mail(): Headers after Bcc headers may be ignored
We need to handle the case where a CRLF after a Bcc header is not the
beginning of a folding marker, because in that case the Bcc header was
not the last "thing".

Closes GH-6666.
2021-02-08 18:42:31 +01:00
Christoph M. Becker 4ff2665509 Use ST_Y() instead of the deprecated/removed Y() in test 2021-02-05 14:53:19 +01:00
Christoph M. Becker 3f8d21b922 Fix #74779: x() and y() truncating floats to integers
We must not use the locale dependent `atof()`, but instead use the
(hopefully) locale independent `zend_strtod()`, when converting string
representations of floating point numbers which are sent by the server.

Closes GH-6665.
2021-02-05 13:09:59 +01:00
Nikita Popov 8b7aaad7d6 Try SIGTERM before SIGKILL in opcache restart
SIGTERM is subject to HANDLE_BLOCK_INTERRUPTIONS(), which will
allow code to exit critical sections before it gets terminated.

Closes GH-6493.
2021-02-04 17:07:18 +01:00
Christoph M. Becker 958e3b93c3 [ci skip] Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix newly introduced compiler warning
2021-02-03 12:43:40 +01:00
Nikita Popov 06c9633b43 Fix newly introduced compiler warning
(cherry picked from commit ab8177de2c)
2021-02-03 12:42:28 +01:00
Christoph M. Becker 1bb2a4f91c Fix #53467: Phar cannot compress large archives
When Phars are flushed, a new temporary file is created for each entry
which should be compressed, and the `compressed_filesize` is retrieved.
Afterwards, the Phar manifest is written, and only after that the files
are copied to the actual Phar.  So for each such entry there is an open
temp file, what easily exceeds the limit.

Therefore, we use a single temporary file for all entries, and store
the start offset in the otherwise unused `header_offset` member.  We
ensure that the `cfp` members are properly set to NULL even if flushing
fails, to avoid use after free scenarios.

This solution is based on a suggestion by @lserni[1].

Closes GH-6643.

[1] <https://github.com/box-project/box2/issues/80#issuecomment-77147371>
2021-02-03 11:22:37 +01:00
Christoph M. Becker 3d09626f0d [ci skip] Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  7.3.28 is next
2021-02-02 17:07:16 +01:00
Christoph M. Becker 039ca4e219 7.3.28 is next 2021-02-02 17:01:55 +01:00
Peter Kokot 8c04944b66 Update year to 2021
Closes GH-6636.
2021-02-02 16:46:16 +01:00
Nikita Popov 54fa0a69f8 Add missing derefs in CurlFile
As pointed out on GH-6456.
2021-02-02 10:31:16 +01:00
Nikita Popov 51d76c346e Fix persistent leak on load_wsdl_ex failure
Move the load_wsdl_ex call into the zend_try that destroys the
docs hash table. The wsdl will be inserted into docs early on,
and will thus be released on subsequent bailout.
2021-02-02 10:05:35 +01:00
Christoph M. Becker 675a9b2831 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Revert "Updated to version 2021.1 (2021a)"
2021-02-01 13:42:43 +01:00
Christoph M. Becker 57257a4335 Revert "Updated to version 2021.1 (2021a)"
This reverts commit 491488d217, since
PHP-7.3 is in security mode, and this does not look security related.
2021-02-01 13:41:32 +01:00
Christoph M. Becker 7e9479083d Fix #80654: file_get_contents() maxlen fails above (2**31)-1 bytes
We remove the arbitrary restriction to `INT_MAX`; it is superfluous on
32bit systems where `ZEND_LONG_MAX == INT_MAX` anyway, and not useful
on 64bit systems, where larger files should be readable, if the
`memory_limit` is large enough.

Closes GH-6648.
2021-02-01 12:57:40 +01:00
Nikita Popov 217b9e7b41 Fix Laravel build on community job
Now requires PHP 7.4, so use php7.4 to run composer everywhere.
2021-02-01 09:48:14 +01:00
Nikita Popov ab8177de2c Fix build 2021-02-01 09:46:17 +01:00
Stanislav Malyshev 86de4d7af6 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix bug #80672 - Null Dereference in SoapClient
2021-01-31 21:42:41 -08:00
Stanislav Malyshev 3c939e3f69 Fix bug #80672 - Null Dereference in SoapClient 2021-01-31 21:15:23 -08:00
Remi Collet aeb4f21549 NEWS 2021-01-28 16:25:35 +01:00
Remi Collet 067f7e4150 Fix #80682 opcache doesn't honour pcre.jit option 2021-01-28 16:24:39 +01:00
Stanislav Malyshev 21f861225a Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Rm unneeded function
2021-01-27 00:15:13 -08:00
Stanislav Malyshev 9c673083cd Rm unneeded function 2021-01-27 00:13:43 -08:00
Stanislav Malyshev fbf8c758fe Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Alternative fix for bug 77423
2021-01-26 22:55:10 -08:00
Christoph M. Becker 4a89e726bd Alternative fix for bug 77423
That bug report originally was about `parse_url()` misbehaving, but the
security aspect was actually only regarding `FILTER_VALIDATE_URL`.
Since the changes to `parse_url_ex()` apparently affect userland code
which is relying on the sloppy URL parsing[1], this alternative
restores the old parsing behavior, but ensures that the userinfo is
checked for correctness for `FILTER_VALIDATE_URL`.

[1] <https://github.com/php/php-src/commit/5174de7cd33c3d4fa591c9c93859ff9989b07e8c#commitcomment-45967652>
2021-01-26 22:54:58 -08:00
Christoph M. Becker 6a0b889f57 Fix #70091: Phar does not mark UTF-8 filenames in ZIP archives
The default encoding of filenames in a ZIP archive is IBM Code Page
437.  Phar, however, only supports UTF-8 filenames.  Therefore we have
to mark filenames as being stored in UTF-8 by setting the general
purpose bit 11 (the language encoding flag).

The effect of not setting this bit for non ASCII filenames can be seen
in popular tools like 7-Zip and UnZip, but not when extracting the
archives via ext/phar (which is agnostic to the filename encoding), or
via ext/zip (which guesses the encoding).  Thus we add a somewhat
brittle low-level test case.

Closes GH-6630.
2021-01-26 19:14:25 +01:00
Christoph M. Becker 94af11d5e1 Update version
That appears to have been forgotten for a while.
2021-01-26 19:08:23 +01:00
Christoph M. Becker 61ed904cec Fix #75850: Unclear error message wrt. __halt_compiler() w/o semicolon
We add the failure reason to the error message.

Closes GH-6638.
2021-01-25 18:47:15 +01:00
Derick Rethans 3f183bbcf8 Updated to version 2021.1 (2021a) 2021-01-25 10:44:05 +00:00
Derick Rethans 072cfef1d5 Empty merge 2021-01-25 10:44:05 +00:00
Derick Rethans 491488d217 Updated to version 2021.1 (2021a) 2021-01-25 10:44:04 +00:00
Christoph M. Becker edb389730d Add missing SKIPIF clause for recently introduced test case 2021-01-21 17:27:09 +01:00
Christoph M. Becker 6adfb8c962 Fix #80648: Fix for bug 79296 should be based on runtime version
Instead of checking for actually affected libzip versions, we now always
`ZIP_TRUNCATE` empty files unless `ZIP_RDONLY` is set.

Closes GH-6625.
2021-01-20 16:20:13 +01:00
Christoph M. Becker 4c1b3e3036 Add missing SKIPIF clauses to new test cases 2021-01-20 11:02:52 +01:00
Derick Rethans a33d0c3aae Update NEWS and version 2021-01-19 14:58:38 +00:00
Derick Rethans e8a89c49db Update NEWS for PHP 7.4.15RC1 2021-01-19 14:44:32 +00:00
sj-i 5d31ee302d Fixed bug #42560
Check open_basedir after the fallback to the system's temporary
directory in tempnam().

In order to preserve the current behavior of upload_tmp_dir
(do not check explicitly specified dir, but check fallback),
new flags are added to check open_basedir for explicit dir
and for fallback.

Closes GH-6526.
2021-01-19 11:41:58 +01:00
Christoph M. BeckerandAnna Filina 68f5289e9e Fix #69279: Compressed ZIP Phar extractTo() creates garbage files
When extracting compressed files from an uncompressed Phar, we must not
use the direct file pointer, but rather get an uncompressed file
pointer.

We also add a test to show that deflated and stored entries are
properly extracted.

This also fixes #79912, which appears to be a duplicate of #69279.

Co-authored-by: Anna Filina <afilina@gmail.com>

Closes GH-6599.
2021-01-19 10:28:54 +01:00
Christoph M. Becker 38ad37ad43 Fix #80595: Resetting POSTFIELDS to empty array breaks request
This is mainly to work around https://github.com/curl/curl/issues/6455,
but not building the mime structure for empty hashtables is a general
performance optimization, so we do not restrict it to affected cURL
versions (7.56.0 to 7.75.0).

The minor change to bug79033.phpt is unexpected, but should not matter
in practice.

Closes GH-6606.
2021-01-18 10:57:56 +01:00
Christoph M. Becker 25103c37aa Revert "Fix #76813: Access violation near NULL on source operand"
This reverts commit 5e15c9c41f, since
re2c default rules are only available as of re2c 0.13.7.
2021-01-11 13:21:12 +01:00
Christoph M. Becker 9450893dc6 Avoid modifying the return value of readline_completion_function()
The internal function `_readline_command_generator()` modifies the
internal array pointer of `readline_completion_function()`'s return
value.  We therefore separate the array, what also avoids failing
assertions regarding the array refcount.

Closes GH-6582.
2021-01-07 13:46:09 +01:00
Christoph M. Becker d1b1c04398 Fix #77565: Incorrect locator detection in ZIP-based phars
We must not assume that the first end of central dir signature in a ZIP
archive actually designates the end of central directory record, since
the data in the archive may contain arbitrary byte patterns.  Thus, we
better search from the end of the data, what is also slightly more
efficient.

There is, however, no way to detect the end of central directory
signature by searching from the end of the ZIP archive with absolute
certainty, since the signature could be part of the trailing comment.
To mitigate, we check that the comment length fits to the found
position, but that might still not be the correct position in rare
cases.

Closes GH-6507.
2021-01-05 23:40:24 +01:00
Christoph M. Becker 5c963731e2 Fix memory leak in Phar::webPhar() on Windows
Closes GH-6574.
2021-01-05 14:21:35 +01:00
Dylan K. Taylor 6b631f073d gdbinit: use ____print_str to print htable keys
I noticed this problem while dumping the contents of EG(function_table),
where keys for closures start with a null byte. printf interprets this
as a zero-length string and emits nothing. This allows the key to be
rendered properly in readable form.

Closes GH-6577.
2021-01-05 10:11:56 +01:00
Nikita Popov 46d6daea7a Disable non-cron travis jobs
This was already done for PHP-8.0 and master, do it for PHP-7.4
as well.
2021-01-04 10:52:37 +01:00
Stanislav Malyshev e65932060a [ci skip] Update NEWS 2021-01-04 01:46:32 -08:00
Stanislav Malyshev ec589a27da Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  [ci skip] Fix order
2021-01-04 01:46:11 -08:00
Stanislav Malyshev 65d7ade684 [ci skip] Fix order 2021-01-04 01:45:15 -08:00
Stanislav Malyshev 2498385dd9 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  [ci skip] Unpdate NEWS
2021-01-04 01:44:18 -08:00
Stanislav Malyshev 8967e66559 [ci skip] Unpdate NEWS 2021-01-04 01:43:45 -08:00
Stanislav Malyshev 434c2b1bdb Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #77423: parse_url() will deliver a wrong host to user
2021-01-01 21:29:08 -08:00
Stanislav Malyshev 128fca4037 Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  Fix #77423: parse_url() will deliver a wrong host to user
2021-01-01 21:06:07 -08:00
Christoph M. Becker 2d3d72412a Fix #77423: parse_url() will deliver a wrong host to user
To avoid that `parse_url()` returns an erroneous host, which would be
valid for `FILTER_VALIDATE_URL`, we make sure that only userinfo which
is valid according to RFC 3986 is treated as such.

For consistency with the existing url parsing code, we use ctype
functions, although that is not necessarily correct.
2021-01-01 20:08:01 -08:00
haszi 0db6f5267c Replace sort() function calls with ksort() in basic ksort test
Closes GH-6541.
2020-12-27 18:30:58 +01:00
Adam SeitzandChristoph M. Becker 70dfbe0068 Fix #80384: limit read buffer size
In the case of a stream with no filters, php_stream_fill_read_buffer
only reads stream->chunk_size into the read buffer. If the stream has
filters attached, it could unnecessarily buffer a large amount of data.

With this change, php_stream_fill_read_buffer only proceeds until either
the requested size or stream->chunk_size is available in the read buffer.

Co-authored-by: Christoph M. Becker <cmbecker69@gmx.de>

Closes GH-6444.
2020-12-23 13:49:56 +01:00
Derick Rethans b043759cb4 Fixed bug #80376 (last day of the month causes runway cpu usage) 2020-12-21 10:30:40 +00:00
Nikita Popov bc166844e3 MySQLnd: Support cursors in store/get result
This fixes two related issues:

1. When a PS with cursor is used in store_result/get_result,
   perform a COM_FETCH with maximum number of rows rather than
   silently switching to an unbuffered result set (in the case of
   store_result) or erroring (in the case of get_result).
   In the future, we might want to make get_result unbuffered for
   PS with cursors, as using cursors with buffered result sets
   doesn't really make sense. Unlike store_result, get_result
   isn't very explicit about what kind of result set is desired.
2. If the client did not request a cursor, but the server reports
   that a cursor exists, ignore this and treat the PS as if it
   has no cursor (i.e. to not use COM_FETCH). It appears to be a
   server side bug that a cursor used inside an SP will be reported
   to the client, even though the client cannot use the cursor.

Fixes bug #64638, bug #72862, bug #77935.

Closes GH-6518.
2020-12-18 10:19:13 +01:00
Nikita Popov 315f3f8dc9 Fixed bug #67983
We need to check the BIT case first, otherwise it will get skipped
in INT_AND_FLOAT_NATIVE mode.
2020-12-16 10:52:27 +01:00
Nikita Popov 118ff03335 Fix bug #80523
Don't truncate the file length to unsigned int...

I have no idea whether that fully fixes the problem because the
process gets OOM killed before finishing, but at least the
immediate parse error is gone now.
2020-12-16 10:20:20 +01:00
Derick Rethans 078cdd8f76 Prepare for 7.4.15 2020-12-15 14:13:29 +00:00
Christoph M. Becker a53d67ceac Fix #77322: PharData::addEmptyDir('/') Possible integer overflow
`phar_path_check()` already strips a leading slash, so we must not
attempt to strip the trailing slash from an now empty directory name.

Closes GH-6508.
2020-12-15 11:44:53 +01:00
Christoph M. Becker c0a1c2c5ee Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  7.3.27 is next
2020-12-15 11:30:46 +01:00
Christoph M. Becker 40d9e3ab86 7.3.27 is next 2020-12-15 11:28:01 +01:00
Calvin Buckley 54248b18fe IBM i PASE doesn't support ITIMER_PROF
Like Cygwin, this platform needs to use a real-time timer.

This was based on a patch by @kadler, but it didn't handle unsetting
the timer, so the timeout would continue to be active, triggering
`hard_timeout` unexpectedly. The patch is fixed to handle unsetting.

Closes GH-6503.
2020-12-15 10:15:28 +01:00
Christoph M. Becker 10c9d615de Drop pdo_mysql_prepare_load_data.phpt
Like the test title and some comments in this test describe, this test
was supposed to have `::prepare()` failing because `LOAD DATA INFILE`
would not be supported as prepared statement, and then the test checks
whether follow-up queries would succeed.  However, `LOAD DATA INFILE`
is supported for prepared statements at least on Windows with mysqlnd,
so the test does no longer test what it is supposed to do.  Therefore,
we drop it.

Closes GH-6509.
2020-12-14 18:26:12 +01:00
Jakub Zelenka a221e17b41 Fix bug #69625: FPM returns 200 status on request without SCRIPT_FILENAME 2020-12-13 18:39:48 +00:00
Nikita Popov e450621f5e Fixed bug #76815
When we receive an error while reading a result set, we should
assume that no more result sets are available. libmysqlclient
implements the same behavior.
2020-12-10 11:23:41 +01:00
Nikita Popov 4922049213 Fixed bug #71145
Consume any additional result sets when running INIT_COMMAND.
2020-12-10 10:28:10 +01:00
Nikita Popov f3d5877845 Backport fix for bug #70066
Given the number of duplicates this bug report had, it seems
worthwhile to fix this on PHP-7.4 as well.

Cherry-pick of 106e7e4bca.
2020-12-10 09:58:47 +01:00
Nikita Popov 44b234a9bc Fixed bug #78154
Handle errors during next_result in exec.
2020-12-09 12:46:47 +01:00
Christoph M. Becker 20e75329f2 Fix #48725: Support for flushing in zlib stream
When `php_zlib_deflate_filter()` is called with `PSFS_FLAG_FLUSH_INC`
but without new buckets being available (e.g. because a user calls
`rewind()` after writing to the stream), we have to make sure that any
pending data are flushed.  This could basically be done like in the
attached patch[1], but that could cause unnessary flushes, which can be
harmful for compression, and adds unnecessary flush markers to the
stream.  Thus, we use the `php_zlib_filter_data.finished` field, which
has not been used for `zlib.deflate` filters, and properly keep track
of the need to flush.

[1] <https://bugs.php.net/patch-display.php?bug_id=48725&patch=zlib-filter-flush-fix.patch&revision=latest>

Closes GH-6019.
2020-12-08 12:23:24 +01:00
Christoph M. Becker 65f5573bc8 Fix #77069: stream filter loses final block of data
Reading from a stream may return greater than zero, but nonetheless the
stream's EOF flag may have been set.  We have to cater to this
condition by setting the close flag for filters.

We also have to cater to that change in the zlib.inflate filter:

If `inflate()` is called with flush mode `Z_FINISH`, but the output
buffer is not large enough to inflate all available data, it fails with
`Z_BUF_ERROR`.  However, `Z_BUF_ERROR` is not fatal; in fact, the zlib
manual states: "If deflate returns with Z_OK or Z_BUF_ERROR, this
function must be called again with Z_FINISH and more output space
(updated avail_out) but no more input data, until it returns with
Z_STREAM_END or an error."  Hence, we do so.

Closes GH-6001.
2020-12-08 11:47:49 +01:00
Nikita Popov bd093ad861 Fixed bug #63185 2020-12-08 11:30:54 +01:00
Dharman a83cc03c13 Fixed bug #80458
If there is no result set (e.g. for upsert queries), still allow
fetching to occur without error, i.e. treat it the same way as
an empty result set.

This normalizes behavior between native and emulated prepared
statements and addresses a regression in PHP 7.4.13.
2020-12-04 16:59:47 +01:00
Christoph M. Becker 8588ae7215 Fix #75102: PharData says invalid checksum for valid tar
Apparently, there are broken tarballs out there which are actually in
ustar format, but did not write the `ustar` marker.  Since popular tar
tools like GNU tar and 7zip have no issues dealing with such tarballs,
Phar should also be more resilient.

Thus, when the first checksum check of a tarball in (presumed) in old-
style format fails, we check whether the checksum would be suitable for
ustar format; if so, we treat the tarball as being in ustar format.

Closes GH-6479.
2020-12-04 13:02:29 +01:00
Paul Crovella 8f8e6f95af Upload coverage data to codecov.io
Closes GH-6486.
2020-12-03 12:04:50 +01:00
Nikita Popov 0f6c41c6f8 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix mysqli_expire_password test for mariadb
2020-12-03 11:01:57 +01:00
Daniel Black 0697a64f7e Fix mysqli_expire_password test for mariadb
In MariaDB-10.4.3 EXPIRE passwords where supported for
MariaDB. This only behaves like MySQL when the system
variable disconnect_on_expired_passwords=1.

MariaDB if there was no password it could not be considered
expired. So the test is adjusted to use actual passwords.
(MariaDB commit a94b20a8e0d9e64eeaabdaaa7a3e03fcdb8a686e)

The error codes produced my MariaDB are different
however still conforming to the SQL specification.

Closes GH-6480.
2020-12-03 10:56:00 +01:00
Daniel Black 5d5c1cea5f fix mysqli_stmt_get_result_metadata_fetch_field test for mariadb
MariaDB extended the default decimal field to 39 characters
instead of MySQL's 31 characters.

This small change allows the test to pass on MySQL and MariaDB.

Closes GH-6484.
2020-12-03 10:45:11 +01:00
Peter Kokot d386ed1e6b Backport fix for bug #78750
Cherry-picks
fe2afef36f
and
86e2b7bb70.
2020-12-03 10:07:09 +01:00
Nikita Popov f2833ca1be Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fixed bug #80457
2020-12-02 11:29:06 +01:00
Nikita Popov d6fcaf5da4 Fixed bug #80457
On x32 sizeof(size_t) != sizeof(zend_long), so we need to be
careful with sign extension here.

Patch by bruno dot premont at restena dot lu.
2020-12-02 11:26:10 +01:00
Christoph M. Becker c283f53b24 Fix #73809: Phar Zip parse crash - mmap fail
Phar signatures practically are of limited size; for the MD5 and SHA
hashes the size is fixed (at most 64 bytes for SHA512); for OpenSSL
public keys there is no size limit in theory, but "64 KiB ought to be
good enough for anybody".  So we check for that limit, to avoid fatal
errors due to out of memory conditions.

Since it is neither possible to have the signature compressed in the
ZIP archive, nor is it possible to manually add a signature via Phar,
we use ZipArchive to create a suitable archive for the test on the fly.

Closes GH-6474.
2020-12-01 16:58:19 +01:00
Nikita Popov ecee3f1209 Next attempt to fix bug #80368
Apparently treating LibreSSL as OpenSSL 1.1 is not just something
we did in our code, it's something that upstream LibreSSL claims,
despite not actually being compatible. Duh.

Check for EVP_CIPH_OCB_MODE instead, which should reliably
determine support...
2020-11-30 15:15:59 +01:00
Christoph M. Becker 5e15c9c41f Fix #76813: Access violation near NULL on source operand
We avoid `YYCURSOR` becoming `NULL` by initializing `YYMARKER`, and add
a default rule for `<NORMAL>` where we catch unexpected input.

We also fix the only superficially related issue regarding empty input
followed by `T_SEPARATOR` and command, which caused another segfault.

Closes GH-6464.
2020-11-30 12:29:24 +01:00
Jakub Zelenka b855907f54 Merge branch 'PHP-7.3' into PHP-7.4 2020-11-27 16:33:47 +00:00
Jakub Zelenka 685708160e Fix test for bug62890 to not depend on system cert store 2020-11-27 16:32:43 +00:00
Nikita Popov 3430d856ac Fix build for non-x86 2020-11-27 17:04:17 +01:00
Nikita Popov 4e30ab33d8 Fix AVX detection
Our CPU detection code currently only checks whether hardware
support for AVX exists. However, we also need to check for operating
system support for XSAVE, as well as whether XCR0 has the SSE and
AVX bits set.

If this is not the case, unset the AVX and AVX2 bits in the cpuinfo
structure.

Hopefully this resolves our issues with CPU support detection.

Closes GH-6460.
2020-11-27 14:49:31 +01:00
Christoph M. Becker 07c5efbd76 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix mysqli_get_client_stats test
2020-11-27 11:50:59 +01:00
Daniel Black 4a10037cb4 Fix mysqli_get_client_stats test
MySQL removed RENAME DATABASE in 18300001c1dbbfddf9a0adcbaeea68956102bdd0
(Sept 2007, 5.1.23). As this briefest existance is very insignificant lets remove it.

It also breaks when testing against MariaDB.

As the alternate path in this test covers all supported MySQL and MariaDB
versions and a signifant portion of unsupported versions lets keep it simple.

Closes GH-6459.
2020-11-27 11:43:34 +01:00
Nikita Popov 0f579fd7c8 Fixed bug #80368
We assume that usually LibreSSL supports everything OpenSSL 1.1 does.
In this instance, this is not the case.
2020-11-27 10:57:19 +01:00
Nikita Popov 5240f8391f Fixed bug #80425
Rename the methods in MessageFormatAdapter to make sure they don't
clash with anything defined by icu itself, which may be a problem
if icu is linked statically.
2020-11-27 10:02:00 +01:00
Nikita Popov ea372e7463 Fix bug #80402: Don't strip -lpthread
The current behavior has been introduced 20 years ago in
f9e375f493 as part of a larger change.
It's not clear to me why special treatement of -lpthread is necessary
here.
2020-11-26 11:54:20 +01:00
Nikita Popov 2fb12be84c Fixed bug #80411
References to null-serializations are stored as null, and as such
are part of the reference count.

Reminds me that we really need to deprecate the mess that is
Serializable.
2020-11-25 17:23:42 +01:00
Dharman 233f507fe6 Fixed error reporting in mysqli_stmt::__construct
For the sake of simplicity, I've synchronized the implementation
with PHP 8, which means null values are also accepted.

Closes GH-6454.
2020-11-25 16:27:41 +01:00
Nikita Popov e3e67b721f Reindent more mysqli tests
Due to a bug in the tidy script, most tests did not actually get
reindented...
2020-11-25 16:07:16 +01:00
Nikita Popov 97d192b444 Reindent ext/mysqli tests
Reindent ext/mysqli tests on PHP-7.4, so they match with the
indentation on PHP-8.0. Otherwise merging test changes across
branches is very unpleasant.
2020-11-25 15:57:11 +01:00
Nikita Popov 706241f82d Fix usage of casted string in ReflectionParameter ctor
Fixes oss-fuzz #27755.
2020-11-24 16:42:16 +01:00
Nikita Popov d016434ad3 Fixed bug #80393
Handle macos versions that don't start with 10.* in libtool.

Patch by kir dot morozov at gmail dot com.
2020-11-24 15:26:40 +01:00
Christoph M. Becker 39f95f5614 Fix #77961: finfo_open crafted magic parsing SIGABRT
libmagic may abort the running process, which is not desirable for PHP;
we raise a fatal error instead.

Closes GH-6437.
2020-11-24 14:01:15 +01:00
Christoph M. Becker 5f9c82d514 Fix #80366: Return Value of zend_fstat() not Checked
In the somewhat unlikely case that `zend_fstat()` fails, we must not
proceed executing the function, but return `false` instead.

Patch based on the patch contributed by sagpant at microsoft dot com.

Closes GH-6432.
2020-11-24 13:09:16 +01:00
Nikita Popov fa713ec17b Fixed bug #80362: Running dtrace scripts can cause php to crash
Patch by al at coralnet dot name.
2020-11-24 13:01:51 +01:00
Christoph M. Becker 221345a013 Fix #77594: ob_tidyhandler is never reset
We reset to original INI value on request shutdown.

Closes GH-6425.
2020-11-22 14:02:29 +01:00
Benjamin Morel ed949a1973 Fix typos in php.ini files
Closes GH-6441.

[ci skip]
2020-11-20 16:50:29 +01:00
Christoph M. Becker 881e43a03c Fix #72964: White space not unfolded for CC/Bcc headers
`\r\n` does only terminate a header, if not followed by `\t` or ` `.
We have to cater to that when determining the end position of the
respective headers.

Closes GH-6420.
2020-11-19 19:25:03 +01:00
Christoph M. Becker c2b1182879 Fix #80345: PHPIZE configuration has outdated PHP_RELEASE_VERSION
We must not redefine the version "constants" for phpize builds, because
these have already generated in phpize.js, from where we pass these
variables forward to configure.js.

We also add `PHP_EXTRA_VERSION` and `PHP_VERSION_STRING` to the files
for completeness.

Closes GH-6419.
2020-11-19 16:23:20 +01:00
Nikita Popov 99a8ec6e24 Short-circuit get_gc for currently running generator 2020-11-18 12:45:29 +01:00
Darek Slusarczyk 79a606bd95 Fix #80312: change default engine from MyISAM to InnoDB in tests
Change mysqli and pdo_mysql tests configuration to use by default
InnoDB instead of MyISAM.

Closes GH-6405.
2020-11-17 13:15:15 +01:00
Nikita Popov df7417d127 Fix incorrectly optimized out live range
For x ? y : z style structures, the live range starts at z, but
may also hold the value of y. Make sure that the refcounting check
takes this into account, by checking the type of a potential phi
user.
2020-11-17 10:19:57 +01:00
Christoph M. Becker 78773890f6 Fix #74558: Can't rebind closure returned by Closure::fromCallable()
Failure to rebind such closures is not necessarily related to them
being created by `ReflectionFunctionAbstract::getClosure()`, so we fix
the error message.

Closes GH-6424.
2020-11-16 14:31:06 +01:00
Nikita Popov eda7492604 Handle errors during next_result() 2020-11-11 16:02:52 +01:00
Derick Rethans c1f8dd4a33 PHP-7.4 is now for 7.4.14 2020-11-10 17:58:21 +00:00
611 changed files with 50779 additions and 44391 deletions

No files matched your search

+3 -4
View File
@@ -11,9 +11,7 @@ end
define ____executor_globals
if basic_functions_module.zts
if !$tsrm_ls
set $tsrm_ls = ts_resource_ex(0, 0)
end
set $tsrm_ls = _tsrm_ls_cache
set $eg = ((zend_executor_globals*) (*((void ***) $tsrm_ls))[executor_globals_id-1])
set $cg = ((zend_compiler_globals*) (*((void ***) $tsrm_ls))[compiler_globals_id-1])
set $eg_ptr = $eg
@@ -352,7 +350,8 @@ define ____print_ht
end
printf "[%d] ", $i
if $p->key
printf "%s => ", $p->key->val
____print_str $p->key->val $p->key->len
printf " => "
else
printf "%d => ", $p->h
end
+3
View File
@@ -70,10 +70,13 @@ jobs:
include:
- env: ENABLE_MAINTAINER_ZTS=0 ENABLE_DEBUG=0
arch: amd64
if: type = cron
- env: ENABLE_MAINTAINER_ZTS=1 ENABLE_DEBUG=1
arch: amd64
if: type = cron
- env: ENABLE_MAINTAINER_ZTS=1 ENABLE_DEBUG=1 SKIP_IO_CAPTURE_TESTS=1 ARM64=1
arch: arm64
if: type = cron
before_script:
- ccache --version
+1 -1
View File
@@ -1,6 +1,6 @@
--------------------------------------------------------------------
The PHP License, version 3.01
Copyright (c) 1999 - 2019 The PHP Group. All rights reserved.
Copyright (c) 1999 - 2021 The PHP Group. All rights reserved.
--------------------------------------------------------------------
Redistribution and use in source and binary forms, with or without
+205
View File
@@ -1,5 +1,210 @@
PHP NEWS
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
29 Apr 2021, PHP 7.4.18
- Core:
. Fixed bug #80781 (Error handler that throws ErrorException infinite loop).
(Nikita)
. Fixed bug #75776 (Flushing streams with compression filter is broken). (cmb)
- Dba:
. Fixed bug #80817 (dba_popen() may cause segfault during RSHUTDOWN). (cmb)
- DOM:
. Fixed bug #66783 (UAF when appending DOMDocument to element). (cmb)
- FPM:
. Fixed bug #80024 (Duplication of info about inherited socket after pool
removing). (Jakub Zelenka)
- FTP:
. Fixed bug #80880 (SSL_read on shutdown, ftp/proc_open). (cmb, Jakub
Zelenka)
- Imap:
. Fixed bug #80710 (imap_mail_compose() header injection). (cmb, Stas)
- Intl:
. Fixed bug #80763 (msgfmt_format() does not accept DateTime references).
(cmb)
- LibXML:
. Fixed bug #51903 (simplexml_load_file() doesn't use HTTP headers). (cmb)
. Fixed bug #73533 (Invalid memory access in php_libxml_xmlCheckUTF8). (cmb)
- MySQLnd:
. Fixed bug #80713 (SegFault when disabling ATTR_EMULATE_PREPARES and
MySQL 8.0). (Nikita)
. Fixed bug #80837 (Calling stmt_store_result after fetch doesn't throw an
error). (Kamil Tekiela)
- Opcache:
. Fixed bug #80805 (create simple class and get error in opcache.so). (Nikita)
. Fixed bug #80950 (Variables become null in if statements). (Nikita)
- Pcntl:
. Fixed bug #79812 (Potential integer overflow in pcntl_exec()). (cmb)
- PCRE:
. Fixed bug #80866 (preg_split ignores limit flag when pattern with \K has
0-width fullstring match). (Kamil Tekiela)
- PDO_ODBC:
. Fixed bug #80783 (PDO ODBC truncates BLOB records at every 256th byte).
(cmb)
- PDO_pgsql:
. Fixed bug #80892 (PDO::PARAM_INT is treated the same as PDO::PARAM_STR).
(Matteo)
- phpdbg:
. Fixed bug #80757 (Exit code is 0 when could not open file). (Felipe)
- Session:
. Fixed bug #80774 (session_name() problem with backslash). (cmb)
. Fixed bug #80889 (Cannot set save handler when save_handler is invalid).
(cmb)
- SOAP:
. Fixed bug #69668 (SOAP special XML characters in namespace URIs not
encoded). (cmb)
- Standard:
. Fixed bug #78719 (http wrapper silently ignores long Location headers).
(cmb)
. Fixed bug #80771 (phpinfo(INFO_CREDITS) displays nothing in CLI). (cmb)
. Fixed bug #80838 (HTTP wrapper waits for HTTP 1 response after HTTP 101).
(manuelm)
. Fixed bug #80915 (Taking a reference to $_SERVER hides its values from
phpinfo()). (Rowan Tommins)
04 Mar 2021, php 7.4.16
- Core:
. Fixed #80706 (mail(): Headers after Bcc headers may be ignored). (cmb)
- MySQLnd:
. Fixed bug #78680 (mysqlnd's mysql_clear_password does not transmit
null-terminated password). (Daniel Black)
- MySQLi:
. Fixed bug #74779 (x() and y() truncating floats to integers). (cmb)
- OPcache:
. Fixed bug #80682 (opcache doesn't honour pcre.jit option). (Remi)
- OpenSSL:
. Fixed bug #80747 (Providing RSA key size < 512 generates key that crash
PHP). (Nikita)
- Phar:
. Fixed bug #75850 (Unclear error message wrt. __halt_compiler() w/o
semicolon) (cmb)
. Fixed bug #70091 (Phar does not mark UTF-8 filenames in ZIP archives). (cmb)
. Fixed bug #53467 (Phar cannot compress large archives). (cmb, lserni)
- SPL:
. Fixed bug#80719 (Iterating after failed ArrayObject::setIteratorClass()
causes Segmentation fault). (Nikita)
- Standard:
. Fixed bug #80654 (file_get_contents() maxlen fails above (2**31)-1 bytes).
(cmb)
- Zip:
. Fixed bug #80648 (Fix for bug 79296 should be based on runtime version).
(cmb, Remi)
04 Feb 2021, PHP 7.4.15
- Core:
. Fixed bug #80523 (bogus parse error on >4GB source code). (Nikita)
. Fixed bug #80384 (filter buffers entire read until file closed). (Adam
Seitz, cmb)
- Curl:
. Fixed bug #80595 (Resetting POSTFIELDS to empty array breaks request). (cmb)
- Date:
. Fixed bug #80376 (last day of the month causes runway cpu usage. (Derick)
- MySQLi:
. Fixed bug #67983 (mysqlnd with MYSQLI_OPT_INT_AND_FLOAT_NATIVE fails to
interpret bit columns). (Nikita)
. Fixed bug #64638 (Fetching resultsets from stored procedure with cursor
fails). (Nikita)
. Fixed bug #72862 (segfault using prepared statements on stored procedures
that use a cursor). (Nikita)
. Fixed bug #77935 (Crash in mysqlnd_fetch_stmt_row_cursor when calling an SP
with a cursor). (Nikita)
- Phar:
. Fixed bug #77565 (Incorrect locator detection in ZIP-based phars). (cmb)
. Fixed bug #69279 (Compressed ZIP Phar extractTo() creates garbage files).
(cmb)
07 Jan 2021, PHP 7.4.14
- Core:
. Fixed bug #74558 (Can't rebind closure returned by Closure::fromCallable()).
(cmb)
. Fixed bug #80345 (PHPIZE configuration has outdated PHP_RELEASE_VERSION).
(cmb)
. Fixed bug #72964 (White space not unfolded for CC/Bcc headers). (cmb)
. Fixed bug #80362 (Running dtrace scripts can cause php to crash).
(al at coralnet dot name)
. Fixed bug #80393 (Build of PHP extension fails due to configuration gap
with libtool). (kir dot morozov at gmail dot com)
. Fixed bug #80402 (configure filtering out -lpthread). (Nikita)
. Fixed bug #77069 (stream filter loses final block of data). (cmb)
- Fileinfo:
. Fixed bug #77961 (finfo_open crafted magic parsing SIGABRT). (cmb)
- FPM:
. Fixed bug #69625 (FPM returns 200 status on request without
SCRIPT_FILENAME env). (Jakub Zelenka)
- Intl:
. Fixed bug #80425 (MessageFormatAdapter::getArgTypeList redefined). (Nikita)
- OpenSSL:
. Fixed bug #80368 (OpenSSL extension fails to build against LibreSSL due to
lack of OCB support). (Nikita)
- Phar:
. Fixed bug #73809 (Phar Zip parse crash - mmap fail). (cmb)
. Fixed bug #75102 (`PharData` says invalid checksum for valid tar). (cmb)
. Fixed bug #77322 (PharData::addEmptyDir('/') Possible integer overflow).
(cmb)
- PDO MySQL:
. Fixed bug #80458 (PDOStatement::fetchAll() throws for upsert queries).
(Kamil Tekiela)
. Fixed bug #63185 (nextRowset() ignores MySQL errors with native prepared
statements). (Nikita)
. Fixed bug #78152 (PDO::exec() - Bad error handling with multiple commands).
(Nikita)
. Fixed bug #70066 (Unexpected "Cannot execute queries while other unbuffered
queries"). (Nikita)
. Fixed bug #71145 (Multiple statements in init command triggers unbuffered
query error). (Nikita)
. Fixed bug #76815 (PDOStatement cannot be GCed/closeCursor-ed when a
PROCEDURE resultset SIGNAL). (Nikita)
- Standard:
. Fixed bug #77423 (FILTER_VALIDATE_URL accepts URLs with invalid userinfo).
(CVE-2020-7071) (cmb)
. Fixed bug #80366 (Return Value of zend_fstat() not Checked). (sagpant, cmb)
. Fixed bug #80411 (References to null-serialized object break serialize()).
(Nikita)
- Tidy:
. Fixed bug #77594 (ob_tidyhandler is never reset). (cmb)
- Zlib:
. Fixed #48725 (Support for flushing in zlib stream). (cmb)
26 Nov 2020, PHP 7.4.13
- Core:
@@ -0,0 +1,15 @@
--TEST--
HT iterator should be destroyed if array becomes empty during array_splice
--FILE--
<?php
$a=[4];
$i = 0;
foreach ($a as &$r) {
var_dump($r);
$a = array_splice($a, 0);
if (++$i == 2) break;
}
?>
--EXPECT--
int(4)
int(4)
+1 -1
View File
@@ -7,4 +7,4 @@ $x = (new ReflectionFunction("substr"))->getClosure();
$x->call(new a);
?>
--EXPECTF--
Warning: Cannot rebind scope of closure created by ReflectionFunctionAbstract::getClosure() in %s on line %d
Warning: Cannot rebind scope of closure created from function in %s on line %d
+1 -1
View File
@@ -18,5 +18,5 @@ var_dump($c);
Warning: Cannot bind method SplDoublyLinkedList::count() to object of class cls in %s on line %d
NULL
Warning: Cannot rebind scope of closure created by ReflectionFunctionAbstract::getClosure() in %s on line %d
Warning: Cannot rebind scope of closure created from method in %s on line %d
NULL
+32
View File
@@ -0,0 +1,32 @@
--TEST--
Bug #80781: Error handler that throws ErrorException infinite loop
--FILE--
<?php
function handle(int $severity, string $message, string $file, int $line): bool {
if((error_reporting() & $severity) !== 0) {
throw new \ErrorException($message, 0, $severity, $file, $line);
}
return true; // stfu operator
}
set_error_handler('handle');
function getPlugin(string $plugin) : bool{
return false;
}
$data = [];
$array = [];
if (isset($array[$data]) or getPlugin($data)) {
}
?>
--EXPECTF--
Fatal error: Uncaught ErrorException: Illegal offset type in isset or empty in %s:%d
Stack trace:
#0 %s(%d): handle(2, 'Illegal offset ...', %s, %d, Array)
#1 {main}
thrown in %s on line %d
+12 -12
View File
@@ -118,10 +118,10 @@ bindTo(new Cls, null):
Success!
bindTo(new Cls, Cls::class):
Cannot rebind scope of closure created by ReflectionFunctionAbstract::getClosure()
Cannot rebind scope of closure created from function
bindTo(null, Cls::class):
Cannot rebind scope of closure created by ReflectionFunctionAbstract::getClosure()
Cannot rebind scope of closure created from function
bindTo(null, stdClass::class):
Cannot bind closure to scope of internal class stdClass
@@ -139,10 +139,10 @@ bindTo(new Cls, null):
Success!
bindTo(new Cls, Cls::class):
Cannot rebind scope of closure created by ReflectionFunctionAbstract::getClosure()
Cannot rebind scope of closure created from function
bindTo(null, Cls::class):
Cannot rebind scope of closure created by ReflectionFunctionAbstract::getClosure()
Cannot rebind scope of closure created from function
bindTo(null, stdClass::class):
Cannot bind closure to scope of internal class stdClass
@@ -163,13 +163,13 @@ bindTo(new Cls, Cls::class):
Cannot bind an instance to a static closure
bindTo(null, null):
Cannot rebind scope of closure created by ReflectionFunctionAbstract::getClosure()
Cannot rebind scope of closure created from method
bindTo(null, ClsChild::class):
Cannot rebind scope of closure created by ReflectionFunctionAbstract::getClosure()
Cannot rebind scope of closure created from method
bindTo(null, ClsUnrelated::class):
Cannot rebind scope of closure created by ReflectionFunctionAbstract::getClosure()
Cannot rebind scope of closure created from method
(new Cls)->method()
-------------------
@@ -189,13 +189,13 @@ bindTo(new ClsUnrelated, Cls::class):
Cannot bind method Cls::method() to object of class ClsUnrelated
bindTo(new Cls, null):
Cannot rebind scope of closure created by ReflectionFunctionAbstract::getClosure()
Cannot rebind scope of closure created from method
bindTo(new Cls, ClsUnrelated::class):
Cannot rebind scope of closure created by ReflectionFunctionAbstract::getClosure()
Cannot rebind scope of closure created from method
bindTo(new Cls, ClsChild::class):
Cannot rebind scope of closure created by ReflectionFunctionAbstract::getClosure()
Cannot rebind scope of closure created from method
(new SplDoublyLinkedList)->count()
----------------------------------
@@ -216,10 +216,10 @@ bindTo(null, SplDoublyLinkedList::class):
Cannot unbind $this of internal method
bindTo(new SplDoublyLinkedList, null):
Cannot rebind scope of closure created by ReflectionFunctionAbstract::getClosure()
Cannot rebind scope of closure created from method
bindTo(new SplDoublyLinkedList, ClsUnrelated::class):
Cannot rebind scope of closure created by ReflectionFunctionAbstract::getClosure()
Cannot rebind scope of closure created from method
(function() {})()
-----------------
@@ -0,0 +1,25 @@
--TEST--
GC on running generator
--FILE--
<?php
function gen() {
yield;
// Trigger GC while $v is being reassigned.
$ary = [new stdClass, new stdClass, new stdClass];
$ary[0]->foo = $ary;
foreach ($ary as &$v) { }
}
for ($i = 0; $i < 10000; $i++) {
// Make sure gen is registered as a GC root.
$gen = gen();
$gen2 = $gen;
unset($gen);
foreach ($gen2 as $v) {}
}
?>
===DONE===
--EXPECT--
===DONE===
+19
View File
@@ -0,0 +1,19 @@
--TEST--
Missing live range if part of phi
--FILE--
<?php
function doThrow() {
throw new Exception("Test");
}
function test($k) {
// The 0 gives the QM_ASSIGN a non-refcounted type.
$res[$k ? $k : 0] = doThrow();
}
try {
test(new stdClass);
} catch (Exception $e) {
echo $e->getMessage(), "\n";
}
?>
--EXPECT--
Test
@@ -0,0 +1,19 @@
--TEST--
Symtable cache slots may be acquired while cleaning symtable
--FILE--
<?php
class A {
// Must be larger than the symtable cache.
static $max = 40;
function __destruct() {
if (self::$max-- < 0) return;
$x = 'y';
$$x = new a;
}
}
new A;
?>
===DONE===
--EXPECT--
===DONE===
+3 -1
View File
@@ -1309,7 +1309,9 @@ static ZEND_COLD void zend_error_va_list(
#ifdef HAVE_DTRACE
if (DTRACE_ERROR_ENABLED()) {
char *dtrace_error_buffer;
zend_vspprintf(&dtrace_error_buffer, 0, format, args);
va_copy(usr_copy, args);
zend_vspprintf(&dtrace_error_buffer, 0, format, usr_copy);
va_end(usr_copy);
DTRACE_ERROR(dtrace_error_buffer, (char *)error_filename, error_lineno);
efree(dtrace_error_buffer);
}
+1 -1
View File
@@ -1099,7 +1099,7 @@ static zend_always_inline void zend_mm_free_pages_ex(zend_mm_heap *heap, zend_mm
/* this setting may be not accurate */
chunk->free_tail = page_num;
}
if (free_chunk && chunk->free_pages == ZEND_MM_PAGES - ZEND_MM_FIRST_PAGE) {
if (free_chunk && chunk != heap->main_chunk && chunk->free_pages == ZEND_MM_PAGES - ZEND_MM_FIRST_PAGE) {
zend_mm_delete_chunk(heap, chunk);
}
}
+5 -1
View File
@@ -104,7 +104,11 @@ static zend_bool zend_valid_closure_binding(
}
if (is_fake_closure && scope != func->common.scope) {
zend_error(E_WARNING, "Cannot rebind scope of closure created by ReflectionFunctionAbstract::getClosure()");
if (func->common.scope == NULL) {
zend_error(E_WARNING, "Cannot rebind scope of closure created from function");
} else {
zend_error(E_WARNING, "Cannot rebind scope of closure created from method");
}
return 0;
}
+43
View File
@@ -73,6 +73,44 @@ static void __zend_cpuid(uint32_t func, uint32_t subfunc, zend_cpu_info *cpuinfo
}
#endif
#if defined(__i386__) || defined(__x86_64__)
/* Function based on compiler-rt implementation. */
static unsigned get_xcr0_eax() {
# if defined(__GNUC__) || defined(__clang__)
// Check xgetbv; this uses a .byte sequence instead of the instruction
// directly because older assemblers do not include support for xgetbv and
// there is no easy way to conditionally compile based on the assembler used.
unsigned eax, edx;
__asm__(".byte 0x0f, 0x01, 0xd0" : "=a"(eax), "=d"(edx) : "c"(0));
return eax;
# elif defined(ZEND_WIN32) && defined(_XCR_XFEATURE_ENABLED_MASK)
return _xgetbv(_XCR_XFEATURE_ENABLED_MASK);
# else
return 0;
# endif
}
static zend_bool is_avx_supported() {
if (!(cpuinfo.ecx & ZEND_CPU_FEATURE_AVX)) {
/* No support for AVX */
return 0;
}
if (!(cpuinfo.ecx & ZEND_CPU_FEATURE_OSXSAVE)) {
/* The operating system does not support XSAVE. */
return 0;
}
if ((get_xcr0_eax() & 0x6) != 0x6) {
/* XCR0 SSE and AVX bits must be set. */
return 0;
}
return 1;
}
#else
static zend_bool is_avx_supported() {
return 0;
}
#endif
void zend_cpu_startup(void)
{
if (!cpuinfo.initialized) {
@@ -95,6 +133,11 @@ void zend_cpu_startup(void)
} else {
cpuinfo.ebx = 0;
}
if (!is_avx_supported()) {
cpuinfo.edx &= ~ZEND_CPU_FEATURE_AVX;
cpuinfo.ebx &= ~(ZEND_CPU_FEATURE_AVX2 & ~ZEND_CPU_EBX_MASK);
}
}
}
+9 -7
View File
@@ -51,11 +51,11 @@
# define ZEND_VM_FP_GLOBAL_REG "%r14"
# define ZEND_VM_IP_GLOBAL_REG "%r15"
# elif defined(__GNUC__) && ZEND_GCC_VERSION >= 4008 && defined(__powerpc64__)
# define ZEND_VM_FP_GLOBAL_REG "r28"
# define ZEND_VM_IP_GLOBAL_REG "r29"
# define ZEND_VM_FP_GLOBAL_REG "r14"
# define ZEND_VM_IP_GLOBAL_REG "r15"
# elif defined(__IBMC__) && ZEND_GCC_VERSION >= 4002 && defined(__powerpc64__)
# define ZEND_VM_FP_GLOBAL_REG "r28"
# define ZEND_VM_IP_GLOBAL_REG "r29"
# define ZEND_VM_FP_GLOBAL_REG "r14"
# define ZEND_VM_IP_GLOBAL_REG "r15"
# elif defined(__GNUC__) && ZEND_GCC_VERSION >= 4008 && defined(__aarch64__)
# define ZEND_VM_FP_GLOBAL_REG "x27"
# define ZEND_VM_IP_GLOBAL_REG "x28"
@@ -3437,12 +3437,13 @@ ZEND_API void execute_internal(zend_execute_data *execute_data, zval *return_val
ZEND_API void zend_clean_and_cache_symbol_table(zend_array *symbol_table) /* {{{ */
{
/* Clean before putting into the cache, since clean could call dtors,
* which could use the cached hash. Also do this before the check for
* available cache slots, as those may be used by a dtor as well. */
zend_symtable_clean(symbol_table);
if (EG(symtable_cache_ptr) >= EG(symtable_cache_limit)) {
zend_array_destroy(symbol_table);
} else {
/* clean before putting into the cache, since clean
could call dtors, which could use cached hash */
zend_symtable_clean(symbol_table);
*(EG(symtable_cache_ptr)++) = symbol_table;
}
}
@@ -4554,6 +4555,7 @@ static zend_always_inline zend_execute_data *_zend_vm_stack_push_call_frame(uint
if (check_exception) { \
OPLINE = EX(opline) + (skip); \
} else { \
ZEND_ASSERT(!EG(exception)); \
OPLINE = opline + (skip); \
} \
ZEND_VM_CONTINUE()
+2 -2
View File
@@ -1294,7 +1294,7 @@ static void zend_set_timeout_ex(zend_long seconds, int reset_signals) /* {{{ */
t_r.it_value.tv_sec = seconds;
t_r.it_value.tv_usec = t_r.it_interval.tv_sec = t_r.it_interval.tv_usec = 0;
# ifdef __CYGWIN__
# if defined(__CYGWIN__) || defined(__PASE__)
setitimer(ITIMER_REAL, &t_r, NULL);
}
signo = SIGALRM;
@@ -1356,7 +1356,7 @@ void zend_unset_timeout(void) /* {{{ */
no_timeout.it_value.tv_sec = no_timeout.it_value.tv_usec = no_timeout.it_interval.tv_sec = no_timeout.it_interval.tv_usec = 0;
# ifdef __CYGWIN__
# if defined(__CYGWIN__) || defined(__PASE__)
setitimer(ITIMER_REAL, &no_timeout, NULL);
# else
setitimer(ITIMER_PROF, &no_timeout, NULL);
+10
View File
@@ -340,6 +340,16 @@ static HashTable *zend_generator_get_gc(zval *object, zval **table, int *n) /* {
return NULL;
}
if (generator->flags & ZEND_GENERATOR_CURRENTLY_RUNNING) {
/* If the generator is currently running, we certainly won't be able to GC any values it
* holds on to. The execute_data state might be inconsistent during execution (e.g. because
* GC has been triggered in the middle of a variable reassignment), so we should not try
* to inspect it here. */
*table = NULL;
*n = 0;
return NULL;
}
op_array = &EX(func)->op_array;
gc_buffer_size = calc_gc_buffer_size(generator);
if (generator->gc_buffer_size < gc_buffer_size) {
+1 -1
View File
@@ -1630,10 +1630,10 @@ ZEND_API void ZEND_FASTCALL zend_array_destroy(HashTable *ht)
} else if (EXPECTED(HT_FLAGS(ht) & HASH_FLAG_UNINITIALIZED)) {
goto free_ht;
}
zend_hash_iterators_remove(ht);
SET_INCONSISTENT(HT_DESTROYED);
efree(HT_GET_DATA_ADDR(ht));
free_ht:
zend_hash_iterators_remove(ht);
FREE_HASHTABLE(ht);
}
+3 -3
View File
@@ -177,7 +177,7 @@ static void yy_pop_state(void)
zend_stack_del_top(&SCNG(state_stack));
}
static void yy_scan_buffer(char *str, unsigned int len)
static void yy_scan_buffer(char *str, size_t len)
{
YYCURSOR = (YYCTYPE*)str;
YYLIMIT = YYCURSOR + len;
@@ -554,7 +554,7 @@ ZEND_API int open_file_for_scanning(zend_file_handle *file_handle)
}
}
SCNG(yy_start) = (unsigned char *)buf;
yy_scan_buffer(buf, (unsigned int)size);
yy_scan_buffer(buf, size);
} else {
zend_error_noreturn(E_COMPILE_ERROR, "zend_stream_mmap() failed");
}
@@ -722,7 +722,7 @@ ZEND_API int zend_prepare_string_for_scanning(zval *str, char *filename)
}
}
yy_scan_buffer(buf, (unsigned int)size);
yy_scan_buffer(buf, size);
new_compiled_filename = zend_string_init(filename, strlen(filename), 0);
zend_set_compiled_filename(new_compiled_filename);
+2 -1
View File
@@ -62,7 +62,8 @@ ZEND_API zend_signal_globals_t zend_signal_globals;
static void zend_signal_handler(int signo, siginfo_t *siginfo, void *context);
static int zend_signal_register(int signo, void (*handler)(int, siginfo_t*, void*));
#ifdef __CYGWIN__
#if defined(__CYGWIN__) || defined(__PASE__)
/* Matches zend_excute_API.c; these platforms don't support ITIMER_PROF. */
#define TIMEOUT_SIG SIGALRM
#else
#define TIMEOUT_SIG SIGPROF
+4
View File
@@ -6937,6 +6937,10 @@ ZEND_VM_C_LABEL(num_index_prop):
ZEND_VM_C_GOTO(isset_again);
} else {
value = zend_find_array_dim_slow(ht, offset EXECUTE_DATA_CC);
if (UNEXPECTED(EG(exception))) {
result = 0;
ZEND_VM_C_GOTO(isset_dim_obj_exit);
}
}
if (!(opline->extended_value & ZEND_ISEMPTY)) {
+36
View File
@@ -6302,6 +6302,10 @@ num_index_prop:
goto isset_again;
} else {
value = zend_find_array_dim_slow(ht, offset EXECUTE_DATA_CC);
if (UNEXPECTED(EG(exception))) {
result = 0;
goto isset_dim_obj_exit;
}
}
if (!(opline->extended_value & ZEND_ISEMPTY)) {
@@ -8496,6 +8500,10 @@ num_index_prop:
goto isset_again;
} else {
value = zend_find_array_dim_slow(ht, offset EXECUTE_DATA_CC);
if (UNEXPECTED(EG(exception))) {
result = 0;
goto isset_dim_obj_exit;
}
}
if (!(opline->extended_value & ZEND_ISEMPTY)) {
@@ -10949,6 +10957,10 @@ num_index_prop:
goto isset_again;
} else {
value = zend_find_array_dim_slow(ht, offset EXECUTE_DATA_CC);
if (UNEXPECTED(EG(exception))) {
result = 0;
goto isset_dim_obj_exit;
}
}
if (!(opline->extended_value & ZEND_ISEMPTY)) {
@@ -14985,6 +14997,10 @@ num_index_prop:
goto isset_again;
} else {
value = zend_find_array_dim_slow(ht, offset EXECUTE_DATA_CC);
if (UNEXPECTED(EG(exception))) {
result = 0;
goto isset_dim_obj_exit;
}
}
if (!(opline->extended_value & ZEND_ISEMPTY)) {
@@ -16402,6 +16418,10 @@ num_index_prop:
goto isset_again;
} else {
value = zend_find_array_dim_slow(ht, offset EXECUTE_DATA_CC);
if (UNEXPECTED(EG(exception))) {
result = 0;
goto isset_dim_obj_exit;
}
}
if (!(opline->extended_value & ZEND_ISEMPTY)) {
@@ -17689,6 +17709,10 @@ num_index_prop:
goto isset_again;
} else {
value = zend_find_array_dim_slow(ht, offset EXECUTE_DATA_CC);
if (UNEXPECTED(EG(exception))) {
result = 0;
goto isset_dim_obj_exit;
}
}
if (!(opline->extended_value & ZEND_ISEMPTY)) {
@@ -41505,6 +41529,10 @@ num_index_prop:
goto isset_again;
} else {
value = zend_find_array_dim_slow(ht, offset EXECUTE_DATA_CC);
if (UNEXPECTED(EG(exception))) {
result = 0;
goto isset_dim_obj_exit;
}
}
if (!(opline->extended_value & ZEND_ISEMPTY)) {
@@ -44950,6 +44978,10 @@ num_index_prop:
goto isset_again;
} else {
value = zend_find_array_dim_slow(ht, offset EXECUTE_DATA_CC);
if (UNEXPECTED(EG(exception))) {
result = 0;
goto isset_dim_obj_exit;
}
}
if (!(opline->extended_value & ZEND_ISEMPTY)) {
@@ -50123,6 +50155,10 @@ num_index_prop:
goto isset_again;
} else {
value = zend_find_array_dim_slow(ht, offset EXECUTE_DATA_CC);
if (UNEXPECTED(EG(exception))) {
result = 0;
goto isset_dim_obj_exit;
}
}
if (!(opline->extended_value & ZEND_ISEMPTY)) {
+4 -4
View File
@@ -50,7 +50,7 @@ jobs:
- script: |
git clone https://github.com/laravel/framework.git --branch=master --depth=1
cd framework
php7.3 /usr/bin/composer install --no-progress
php7.4 /usr/bin/composer install --no-progress
export USE_ZEND_ALLOC=0
sed -i 's/$exit = true/$exit = false/g' vendor/phpunit/phpunit/src/TextUI/Command.php
# Avoid test using exit(), which thus leaks.
@@ -61,8 +61,8 @@ jobs:
- script: |
git clone https://github.com/symfony/symfony.git --depth=1
cd symfony
php7.3 /usr/bin/composer install --no-progress
php7.3 ./phpunit install
php7.4 /usr/bin/composer install --no-progress
php7.4 ./phpunit install
export USE_ZEND_ALLOC=0
export USE_TRACKED_ALLOC=1
export ASAN_OPTIONS=exitcode=139
@@ -82,7 +82,7 @@ jobs:
displayName: 'Test Amphp'
condition: or(succeeded(), failed())
- script: |
php7.3 /usr/bin/composer create-project symfony/symfony-demo symfony_demo --no-progress
php7.4 /usr/bin/composer create-project symfony/symfony-demo symfony_demo --no-progress
cd symfony_demo
export USE_ZEND_ALLOC=0
export USE_TRACKED_ALLOC=1
+4 -1
View File
@@ -32,10 +32,13 @@ jobs:
runTestsParameters: >-
${{ parameters.runTestsParameters }}
-d zend_extension=opcache.so
- script: bash <(curl -s https://codecov.io/bash)
displayName: 'Upload ${{ parameters.configurationName }} Test Coverage to Codecov.io'
condition: or(succeeded(), failed())
- script: |
make gcovr-xml
mv gcovr.xml coverage.xml
displayName: 'Generate ${{ parameters.configurationName }} Test Coverage'
displayName: 'Generate ${{ parameters.configurationName }} Test Coverage Cobertura XML Report'
condition: or(succeeded(), failed())
- task: PublishCodeCoverageResults@1
inputs:
+1 -1
View File
@@ -5,7 +5,7 @@ parameters:
jobs:
- job: ${{ parameters.configurationName }}
pool:
vmImage: 'ubuntu-18.04'
vmImage: 'ubuntu-20.04'
steps:
- template: apt.yml
- script: |
+3 -3
View File
@@ -340,7 +340,7 @@ AC_DEFUN([_LT_REQUIRED_DARWIN_CHECKS],[
_lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;;
10.[[012]]*)
_lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;;
10.*)
*)
_lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;;
esac
;;
@@ -1521,7 +1521,7 @@ darwin* | rhapsody*)
shlibpath_var=DYLD_LIBRARY_PATH
shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`'
ifelse([$1], [],[
sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib"])
sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib"])
sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib'
;;
@@ -5799,7 +5799,7 @@ _LT_EOF
10.[[012]])
_LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
;;
10.*)
*)
_LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-undefined ${wl}dynamic_lookup'
;;
esac
+7 -1
View File
@@ -498,7 +498,7 @@ dnl Internal, don't use.
dnl
AC_DEFUN([_PHP_ADD_LIBRARY_SKELETON],[
case $1 in
c|c_r|pthread*[)] ;;
c|c_r[)] ;;
*[)] ifelse($3,,[
_PHP_X_ADD_LIBRARY($1,$2,$5)
],[
@@ -1783,6 +1783,9 @@ AC_DEFUN([PHP_PROG_BISON], [
AC_MSG_CHECKING([for bison version])
php_bison_version=$($YACC --version 2> /dev/null | grep 'GNU Bison' | cut -d ' ' -f 4 | tr -d a-z)
if test -z "$php_bison_version"; then
php_bison_version=0.0.0
fi
ac_IFS=$IFS; IFS="."
set $php_bison_version
IFS=$ac_IFS
@@ -1846,6 +1849,9 @@ AC_DEFUN([PHP_PROG_RE2C],[
AC_MSG_CHECKING([for re2c version])
php_re2c_version=$($RE2C --version | cut -d ' ' -f 2 2>/dev/null)
if test -z "$php_re2c_version"; then
php_re2c_version=0.0.0
fi
ac_IFS=$IFS; IFS="."
set $php_re2c_version
IFS=$ac_IFS
+2 -2
View File
@@ -17,7 +17,7 @@ dnl Basic autoconf initialization, generation of config.nice.
dnl ----------------------------------------------------------------------------
AC_PREREQ([2.68])
AC_INIT([PHP],[7.4.13],[https://bugs.php.net],[php],[https://www.php.net])
AC_INIT([PHP],[7.4.18],[https://bugs.php.net],[php],[https://www.php.net])
AC_CONFIG_SRCDIR([main/php_version.h])
AC_CONFIG_AUX_DIR([build])
AC_PRESERVE_HELP_ORDER
@@ -568,7 +568,7 @@ dnl Fix for these systems is already included in GCC 7, but not on GCC 6.
dnl
dnl At least some versions of FreeBSD seem to have buggy ifunc support, see
dnl bug #77284. Conservatively don't use ifuncs on FreeBSD.
AS_CASE([$host_alias], [*-*-*android*|*-*-*uclibc*|*-*-*musl*|*freebsd*], [true], [
AS_CASE([$host_alias], [*-*-*android*|*-*-*uclibc*|*-*-*musl*|*freebsd*|*openbsd*], [true], [
AX_GCC_FUNC_ATTRIBUTE([ifunc])
AX_GCC_FUNC_ATTRIBUTE([target])
])
+10 -3
View File
@@ -41,6 +41,7 @@ typedef struct _php_bz2_filter_data {
enum strm_status status; /* Decompress option */
unsigned int small_footprint : 1; /* Decompress option */
unsigned int expect_concatenated : 1; /* Decompress option */
unsigned int is_flushed : 1; /* only for compression */
int persistent;
} php_bz2_filter_data;
@@ -228,6 +229,8 @@ static php_stream_filter_status_t php_bz2_compress_filter(
bucket = php_stream_bucket_make_writeable(buckets_in->head);
while (bin < bucket->buflen) {
int flush_mode;
desired = bucket->buflen - bin;
if (desired > data->inbuf_len) {
desired = data->inbuf_len;
@@ -235,7 +238,9 @@ static php_stream_filter_status_t php_bz2_compress_filter(
memcpy(data->strm.next_in, bucket->buf + bin, desired);
data->strm.avail_in = desired;
status = BZ2_bzCompress(&(data->strm), flags & PSFS_FLAG_FLUSH_CLOSE ? BZ_FINISH : (flags & PSFS_FLAG_FLUSH_INC ? BZ_FLUSH : BZ_RUN));
flush_mode = flags & PSFS_FLAG_FLUSH_CLOSE ? BZ_FINISH : (flags & PSFS_FLAG_FLUSH_INC ? BZ_FLUSH : BZ_RUN);
data->is_flushed = flush_mode != BZ_RUN;
status = BZ2_bzCompress(&(data->strm), flush_mode);
if (status != BZ_RUN_OK && status != BZ_FLUSH_OK && status != BZ_FINISH_OK) {
/* Something bad happened */
php_stream_bucket_delref(bucket);
@@ -261,11 +266,12 @@ static php_stream_filter_status_t php_bz2_compress_filter(
php_stream_bucket_delref(bucket);
}
if (flags & PSFS_FLAG_FLUSH_CLOSE) {
if (flags & PSFS_FLAG_FLUSH_CLOSE || ((flags & PSFS_FLAG_FLUSH_INC) && !data->is_flushed)) {
/* Spit it out! */
status = BZ_FINISH_OK;
while (status == BZ_FINISH_OK) {
status = BZ2_bzCompress(&(data->strm), BZ_FINISH);
status = BZ2_bzCompress(&(data->strm), (flags & PSFS_FLAG_FLUSH_CLOSE ? BZ_FINISH : BZ_FLUSH));
data->is_flushed = 1;
if (data->strm.avail_out < data->outbuf_len) {
size_t bucketlen = data->outbuf_len - data->strm.avail_out;
@@ -381,6 +387,7 @@ static php_stream_filter *php_bz2_filter_create(const char *filtername, zval *fi
}
status = BZ2_bzCompressInit(&(data->strm), blockSize100k, 0, workFactor);
data->is_flushed = 1;
fops = &php_bz2_compress_ops;
} else {
status = BZ_DATA_ERROR;
+24
View File
@@ -0,0 +1,24 @@
--TEST--
Bug #75776 (Flushing streams with compression filter is broken)
--SKIPIF--
<?php
if (!extension_loaded('bz2')) die('skip bz2 extension not available');
?>
--FILE--
<?php
$text = str_repeat('0123456789abcdef', 1000);
$temp = fopen('php://temp', 'r+');
stream_filter_append($temp, 'bzip2.compress', STREAM_FILTER_WRITE);
fwrite($temp, $text);
rewind($temp);
var_dump(bin2hex(stream_get_contents($temp)));
var_dump(ftell($temp));
fclose($temp);
?>
--EXPECT--
string(144) "425a68343141592653599fe7bbbf0001f389007fe03f002000902980026826aa80003ea9061520c6a41954833a9069520d6a41b54837a9071520e6a41d5483ba9079520f6a41f548"
int(72)
+11 -1
View File
@@ -2207,6 +2207,7 @@ static inline int build_mime_structure_from_hash(php_curl *ch, zval *zpostfields
#endif
prop = zend_read_property(curl_CURLFile_class, current, "name", sizeof("name")-1, 0, &rv);
ZVAL_DEREF(prop);
if (Z_TYPE_P(prop) != IS_STRING) {
php_error_docref(NULL, E_WARNING, "Invalid filename for key %s", ZSTR_VAL(string_key));
} else {
@@ -2217,10 +2218,12 @@ static inline int build_mime_structure_from_hash(php_curl *ch, zval *zpostfields
}
prop = zend_read_property(curl_CURLFile_class, current, "mime", sizeof("mime")-1, 0, &rv);
ZVAL_DEREF(prop);
if (Z_TYPE_P(prop) == IS_STRING && Z_STRLEN_P(prop) > 0) {
type = Z_STRVAL_P(prop);
}
prop = zend_read_property(curl_CURLFile_class, current, "postname", sizeof("postname")-1, 0, &rv);
ZVAL_DEREF(prop);
if (Z_TYPE_P(prop) == IS_STRING && Z_STRLEN_P(prop) > 0) {
filename = Z_STRVAL_P(prop);
}
@@ -2969,7 +2972,14 @@ static int _php_curl_setopt(php_curl *ch, zend_long option, zval *zvalue) /* {{{
case CURLOPT_POSTFIELDS:
if (Z_TYPE_P(zvalue) == IS_ARRAY || Z_TYPE_P(zvalue) == IS_OBJECT) {
return build_mime_structure_from_hash(ch, zvalue);
if (zend_hash_num_elements(HASH_OF(zvalue)) == 0) {
/* no need to build the mime structure for empty hashtables;
also works around https://github.com/curl/curl/issues/6455 */
curl_easy_setopt(ch->cp, CURLOPT_POSTFIELDS, "");
error = curl_easy_setopt(ch->cp, CURLOPT_POSTFIELDSIZE, 0);
} else {
return build_mime_structure_from_hash(ch, zvalue);
}
} else {
#if LIBCURL_VERSION_NUM >= 0x071101
zend_string *tmp_str;
+2 -1
View File
@@ -21,9 +21,10 @@ var_dump(curl_getinfo($ch)["request_header"]);
string(%d) "array(0) {
}
"
string(90) "POST /get.inc?test=post HTTP/1.1
string(%d) "POST /get.inc?test=post HTTP/1.1
Host: localhost:%d
Accept: */*
Content-Length: 0
Content-Type: application/x-www-form-urlencoded
"
+30
View File
@@ -0,0 +1,30 @@
--TEST--
Bug #80595 (Resetting POSTFIELDS to empty array breaks request)
--SKIPIF--
<?php include 'skipif.inc'; ?>
--FILE--
<?php
include 'server.inc';
$host = curl_cli_server_start();
$ch = curl_init();
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
CURLOPT_URL => "{$host}/get.inc?test=post",
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, ['foo' => 'bar']);
var_dump(curl_exec($ch));
curl_setopt($ch, CURLOPT_POSTFIELDS, []);
var_dump(curl_exec($ch));
?>
--EXPECT--
string(43) "array(1) {
["foo"]=>
string(3) "bar"
}
"
string(13) "array(0) {
}
"
+22837 -20045
View File
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
+2681 -2482
View File
File diff suppressed because it is too large. Load diff
+2 -2
View File
@@ -972,9 +972,9 @@ restart:
zend_bool close_both;
close_both = (info->fp != info->lock.fp);
php_stream_close(info->lock.fp);
php_stream_free(info->lock.fp, persistent ? PHP_STREAM_FREE_CLOSE_PERSISTENT : PHP_STREAM_FREE_CLOSE);
if (close_both) {
php_stream_close(info->fp);
php_stream_free(info->fp, persistent ? PHP_STREAM_FREE_CLOSE_PERSISTENT : PHP_STREAM_FREE_CLOSE);
}
info->fp = NULL;
info->lock.fp = NULL;
+7 -3
View File
@@ -1302,9 +1302,13 @@ int dom_hierarchy(xmlNodePtr parent, xmlNodePtr child)
{
xmlNodePtr nodep;
if (parent == NULL || child == NULL || child->doc != parent->doc) {
return SUCCESS;
}
if (parent == NULL || child == NULL || child->doc != parent->doc) {
return SUCCESS;
}
if (child->type == XML_DOCUMENT_NODE) {
return FAILURE;
}
nodep = parent;
@@ -9,7 +9,7 @@ require_once __DIR__ .'/skipif.inc';
?>
--FILE--
<?php
$filename = __DIR__."/tmp_savehtmlfile".time().".html";
$filename = __DIR__."/DOMDocument_saveHTMLFile_basic.html";
$doc = new DOMDocument('1.0');
$root = $doc->createElement('html');
$root = $doc->appendChild($root);
@@ -9,7 +9,7 @@ require_once __DIR__ .'/skipif.inc';
?>
--FILE--
<?php
$filename = __DIR__."/tmp_savehtmlfile".time().".html";
$filename = __DIR__."/DOMDocument_saveHTMLFile_formatOutput.html";
$doc = new DOMDocument('1.0');
$doc->formatOutput = true;
$root = $doc->createElement('html');
+19
View File
@@ -0,0 +1,19 @@
--TEST--
Bug #66783 (UAF when appending DOMDocument to element)
--SKIPIF--
<?php
if (!extension_loaded('dom')) die('skip dom extension not available');
?>
--FILE--
<?php
$doc = new DomDocument;
$doc->loadXML('<root></root>');
$e = $doc->createElement('e');
try {
$e->appendChild($doc);
} catch (DOMException $ex) {
echo $ex->getMessage(), PHP_EOL;
}
?>
--EXPECTF--
Hierarchy Request Error
+38 -31
View File
@@ -1,6 +1,6 @@
diff -u libmagic.orig/apprentice.c libmagic/apprentice.c
--- libmagic.orig/apprentice.c 2019-02-20 03:35:27.000000000 +0100
+++ libmagic/apprentice.c 2020-02-27 11:45:38.445854000 +0100
+++ libmagic/apprentice.c 2020-11-19 11:50:32.412674100 +0100
@@ -29,6 +29,8 @@
* apprentice - make one pass through /etc/magic, learning its secrets.
*/
@@ -974,7 +974,7 @@ diff -u libmagic.orig/apprentice.c libmagic/apprentice.c
}
diff -u libmagic.orig/ascmagic.c libmagic/ascmagic.c
--- libmagic.orig/ascmagic.c 2019-05-07 04:27:11.000000000 +0200
+++ libmagic/ascmagic.c 2020-02-26 23:18:22.605400700 +0100
+++ libmagic/ascmagic.c 2020-09-07 00:42:14.447562400 +0200
@@ -96,7 +96,7 @@
rv = file_ascmagic_with_encoding(ms, &bb,
ubuf, ulen, code, type, text);
@@ -1005,7 +1005,7 @@ diff -u libmagic.orig/ascmagic.c libmagic/ascmagic.c
}
diff -u libmagic.orig/buffer.c libmagic/buffer.c
--- libmagic.orig/buffer.c 2019-05-07 04:27:11.000000000 +0200
+++ libmagic/buffer.c 2020-02-27 11:45:38.445854000 +0100
+++ libmagic/buffer.c 2020-09-07 00:42:14.447562400 +0200
@@ -31,19 +31,23 @@
#endif /* lint */
@@ -1062,7 +1062,7 @@ diff -u libmagic.orig/buffer.c libmagic/buffer.c
diff -u libmagic.orig/cdf.c libmagic/cdf.c
--- libmagic.orig/cdf.c 2019-02-20 03:35:27.000000000 +0100
+++ libmagic/cdf.c 2020-02-27 11:45:38.445854000 +0100
+++ libmagic/cdf.c 2020-09-07 00:42:14.447562400 +0200
@@ -43,7 +43,17 @@
#include <err.h>
#endif
@@ -1341,7 +1341,7 @@ diff -u libmagic.orig/cdf.c libmagic/cdf.c
#endif
diff -u libmagic.orig/cdf.h libmagic/cdf.h
--- libmagic.orig/cdf.h 2019-02-20 02:24:19.000000000 +0100
+++ libmagic/cdf.h 2020-02-27 11:45:38.445854000 +0100
+++ libmagic/cdf.h 2020-09-07 00:42:14.447562400 +0200
@@ -35,10 +35,10 @@
#ifndef _H_CDF_
#define _H_CDF_
@@ -1366,7 +1366,7 @@ diff -u libmagic.orig/cdf.h libmagic/cdf.h
#define CDF_SECID_FREE -1
diff -u libmagic.orig/cdf_time.c libmagic/cdf_time.c
--- libmagic.orig/cdf_time.c 2019-03-12 21:43:05.000000000 +0100
+++ libmagic/cdf_time.c 2020-02-26 23:18:22.611402900 +0100
+++ libmagic/cdf_time.c 2020-09-07 00:42:14.447562400 +0200
@@ -23,6 +23,7 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
@@ -1395,7 +1395,7 @@ diff -u libmagic.orig/cdf_time.c libmagic/cdf_time.c
(void)snprintf(buf, 26, "*Bad* %#16.16" INT64_T_FORMAT "x\n",
diff -u libmagic.orig/compress.c libmagic/compress.c
--- libmagic.orig/compress.c 2019-05-07 04:27:11.000000000 +0200
+++ libmagic/compress.c 2020-02-27 11:45:38.445854000 +0100
+++ libmagic/compress.c 2020-09-07 00:42:14.447562400 +0200
@@ -45,13 +45,11 @@
#endif
#include <string.h>
@@ -1545,7 +1545,7 @@ diff -u libmagic.orig/compress.c libmagic/compress.c
+#endif
diff -u libmagic.orig/der.c libmagic/der.c
--- libmagic.orig/der.c 2019-02-20 03:35:27.000000000 +0100
+++ libmagic/der.c 2020-02-27 11:45:38.445854000 +0100
+++ libmagic/der.c 2020-09-07 00:42:14.447562400 +0200
@@ -51,7 +51,9 @@
#include "magic.h"
#include "der.h"
@@ -1575,7 +1575,7 @@ diff -u libmagic.orig/der.c libmagic/der.c
snprintf(buf + z, blen - z, "%.2x", d[i]);
diff -u libmagic.orig/elfclass.h libmagic/elfclass.h
--- libmagic.orig/elfclass.h 2019-02-20 02:30:19.000000000 +0100
+++ libmagic/elfclass.h 2020-02-26 23:18:22.613401700 +0100
+++ libmagic/elfclass.h 2020-09-07 00:42:14.447562400 +0200
@@ -41,7 +41,7 @@
return toomany(ms, "program headers", phnum);
flags |= FLAGS_IS_CORE;
@@ -1605,7 +1605,7 @@ diff -u libmagic.orig/elfclass.h libmagic/elfclass.h
CAST(int, elf_getu16(swap, elfhdr.e_shstrndx)),
diff -u libmagic.orig/encoding.c libmagic/encoding.c
--- libmagic.orig/encoding.c 2019-04-15 18:48:41.000000000 +0200
+++ libmagic/encoding.c 2020-02-26 23:18:22.614402300 +0100
+++ libmagic/encoding.c 2020-09-07 00:42:14.447562400 +0200
@@ -89,13 +89,13 @@
*code_mime = "binary";
@@ -1636,7 +1636,7 @@ diff -u libmagic.orig/encoding.c libmagic/encoding.c
}
diff -u libmagic.orig/file.h libmagic/file.h
--- libmagic.orig/file.h 2019-05-07 04:27:11.000000000 +0200
+++ libmagic/file.h 2020-02-27 11:45:38.445854000 +0100
+++ libmagic/file.h 2020-11-23 17:11:36.234964700 +0100
@@ -33,18 +33,9 @@
#ifndef __file_h__
#define __file_h__
@@ -1658,7 +1658,7 @@ diff -u libmagic.orig/file.h libmagic/file.h
#ifdef _WIN64
#define SIZE_T_FORMAT "I64"
#else
@@ -57,19 +48,34 @@
@@ -57,32 +48,49 @@
#define INT64_T_FORMAT "ll"
#define INTMAX_T_FORMAT "j"
#endif
@@ -1698,7 +1698,14 @@ diff -u libmagic.orig/file.h libmagic/file.h
#include <sys/param.h>
#endif
/* Do this here and now, because struct stat gets re-defined on solaris */
@@ -82,7 +88,7 @@
#include <sys/stat.h>
#include <stdarg.h>
+#define abort() zend_error_noreturn(E_ERROR, "fatal libmagic error")
+
#define ENABLE_CONDITIONALS
#ifndef MAGIC
#define MAGIC "/etc/magic"
#endif
@@ -1707,7 +1714,7 @@ diff -u libmagic.orig/file.h libmagic/file.h
#define PATHSEP ';'
#else
#define PATHSEP ':'
@@ -116,12 +122,6 @@
@@ -116,12 +124,6 @@
#endif
#endif
@@ -1720,7 +1727,7 @@ diff -u libmagic.orig/file.h libmagic/file.h
#ifndef MIN
#define MIN(a,b) (((a) < (b)) ? (a) : (b))
#endif
@@ -150,10 +150,10 @@
@@ -150,10 +152,10 @@
struct buffer {
int fd;
@@ -1733,7 +1740,7 @@ diff -u libmagic.orig/file.h libmagic/file.h
void *ebuf;
size_t elen;
};
@@ -243,7 +243,7 @@
@@ -243,7 +245,7 @@
#define FILE_DER 48
#define FILE_NAMES_SIZE 49 /* size of array to contain all names */
@@ -1742,7 +1749,7 @@ diff -u libmagic.orig/file.h libmagic/file.h
((t) == FILE_STRING || \
(t) == FILE_PSTRING || \
(t) == FILE_BESTRING16 || \
@@ -447,28 +447,23 @@
@@ -447,28 +449,23 @@
/* Type for Unicode characters */
typedef unsigned long unichar;
@@ -1776,7 +1783,7 @@ diff -u libmagic.orig/file.h libmagic/file.h
protected int file_zmagic(struct magic_set *, const struct buffer *,
const char *);
#endif
@@ -491,13 +486,9 @@
@@ -491,13 +488,9 @@
protected void file_badread(struct magic_set *);
protected void file_badseek(struct magic_set *);
protected void file_oomem(struct magic_set *, size_t);
@@ -1793,7 +1800,7 @@ diff -u libmagic.orig/file.h libmagic/file.h
protected void file_showstr(FILE *, const char *, size_t);
protected size_t file_mbswidth(const char *);
protected const char *file_getbuffer(struct magic_set *);
@@ -513,34 +504,13 @@
@@ -513,34 +506,13 @@
size_t);
#endif /* __EMX__ */
@@ -1831,7 +1838,7 @@ diff -u libmagic.orig/file.h libmagic/file.h
typedef struct {
char *buf;
@@ -550,28 +520,13 @@
@@ -550,28 +522,13 @@
protected file_pushbuf_t *file_push_buffer(struct magic_set *);
protected char *file_pop_buffer(struct magic_set *, file_pushbuf_t *);
@@ -1862,7 +1869,7 @@ diff -u libmagic.orig/file.h libmagic/file.h
size_t strlcat(char *, const char *, size_t);
#endif
#ifndef HAVE_STRCASESTR
@@ -587,39 +542,6 @@
@@ -587,39 +544,6 @@
#ifndef HAVE_ASCTIME_R
char *asctime_r(const struct tm *, char *);
#endif
@@ -1902,7 +1909,7 @@ diff -u libmagic.orig/file.h libmagic/file.h
#if defined(HAVE_MMAP) && defined(HAVE_SYS_MMAN_H) && !defined(QUICK)
#define QUICK
@@ -645,6 +567,18 @@
@@ -645,6 +569,18 @@
#else
#define FILE_RCSID(id)
#endif
@@ -1923,7 +1930,7 @@ diff -u libmagic.orig/file.h libmagic/file.h
#endif
diff -u libmagic.orig/fsmagic.c libmagic/fsmagic.c
--- libmagic.orig/fsmagic.c 2019-05-07 04:26:48.000000000 +0200
+++ libmagic/fsmagic.c 2020-02-26 23:18:22.616403500 +0100
+++ libmagic/fsmagic.c 2020-09-07 00:42:14.447562400 +0200
@@ -66,26 +66,10 @@
# define minor(dev) ((dev) & 0xff)
#endif
@@ -2216,7 +2223,7 @@ diff -u libmagic.orig/fsmagic.c libmagic/fsmagic.c
case S_IFSOCK:
diff -u libmagic.orig/funcs.c libmagic/funcs.c
--- libmagic.orig/funcs.c 2019-05-07 04:27:11.000000000 +0200
+++ libmagic/funcs.c 2020-02-27 11:45:38.445854000 +0100
+++ libmagic/funcs.c 2020-09-07 00:42:14.447562400 +0200
@@ -31,7 +31,6 @@
#endif /* lint */
@@ -2572,7 +2579,7 @@ diff -u libmagic.orig/funcs.c libmagic/funcs.c
diff -u libmagic.orig/magic.c libmagic/magic.c
--- libmagic.orig/magic.c 2019-05-07 04:27:11.000000000 +0200
+++ libmagic/magic.c 2020-02-26 23:18:22.621402800 +0100
+++ libmagic/magic.c 2020-09-07 00:42:14.447562400 +0200
@@ -25,11 +25,6 @@
* SUCH DAMAGE.
*/
@@ -3036,8 +3043,8 @@ diff -u libmagic.orig/magic.c libmagic/magic.c
public const char *
magic_error(struct magic_set *ms)
diff -u libmagic.orig/magic.h libmagic/magic.h
--- libmagic.orig/magic.h 2020-03-02 15:24:27.253951700 +0100
+++ libmagic/magic.h 2020-02-26 23:18:22.622402300 +0100
--- libmagic.orig/magic.h 2020-11-23 17:12:12.776465800 +0100
+++ libmagic/magic.h 2020-09-07 00:42:14.447562400 +0200
@@ -124,6 +124,7 @@
const char *magic_getpath(const char *, int);
@@ -3048,7 +3055,7 @@ diff -u libmagic.orig/magic.h libmagic/magic.h
diff -u libmagic.orig/print.c libmagic/print.c
--- libmagic.orig/print.c 2019-03-12 21:43:05.000000000 +0100
+++ libmagic/print.c 2020-02-26 23:18:22.625401800 +0100
+++ libmagic/print.c 2020-09-07 00:42:14.447562400 +0200
@@ -28,6 +28,7 @@
/*
* print.c - debugging printout routines
@@ -3122,7 +3129,7 @@ diff -u libmagic.orig/print.c libmagic/print.c
goto out;
diff -u libmagic.orig/readcdf.c libmagic/readcdf.c
--- libmagic.orig/readcdf.c 2019-03-12 21:43:05.000000000 +0100
+++ libmagic/readcdf.c 2020-02-27 11:45:38.445854000 +0100
+++ libmagic/readcdf.c 2020-09-07 00:42:14.463191200 +0200
@@ -31,7 +31,11 @@
#include <assert.h>
@@ -3241,7 +3248,7 @@ diff -u libmagic.orig/readcdf.c libmagic/readcdf.c
if (i != -1)
diff -u libmagic.orig/softmagic.c libmagic/softmagic.c
--- libmagic.orig/softmagic.c 2019-05-17 04:24:59.000000000 +0200
+++ libmagic/softmagic.c 2020-03-02 15:23:10.176763300 +0100
+++ libmagic/softmagic.c 2020-09-07 00:42:14.463191200 +0200
@@ -43,6 +43,10 @@
#include <time.h>
#include "der.h"
@@ -3608,7 +3615,7 @@ diff -u libmagic.orig/softmagic.c libmagic/softmagic.c
case FILE_INDIRECT:
diff -u libmagic.orig/strcasestr.c libmagic/strcasestr.c
--- libmagic.orig/strcasestr.c 2014-09-11 17:05:33.000000000 +0200
+++ libmagic/strcasestr.c 2019-11-29 08:49:38.434136600 +0100
+++ libmagic/strcasestr.c 2020-08-05 15:01:55.644887300 +0200
@@ -39,6 +39,8 @@
#include "file.h"
+2
View File
@@ -82,6 +82,8 @@
#include <sys/stat.h>
#include <stdarg.h>
#define abort() zend_error_noreturn(E_ERROR, "fatal libmagic error")
#define ENABLE_CONDITIONALS
#ifndef MAGIC
+50
View File
@@ -0,0 +1,50 @@
0 string 1
>1 regex \^[0-9:,\ ]*-->[0-9:,\ ]* SubRip File
!:mime text/x-srt
0 lelong 0xc3cbc6c5 RISC OS Chunk data
>12 string OBJ_ \b, AOF object
>12 string LIB_ \b, ALF library
0 name mach-o \b [
>0 use mach-o-cpu \b
>(8.L) indirect 8 \b:
>0 belong x \b]
0 belong 0xcafed00d JAR compressed with pack200,
>5 byte x version %d.
>4 byte x \b%d
!:mime application/x-java-pack200
# Objective-C
0 regex \^#import Objective-C source text
!:strength + 25
!:mime text/x-objective-c
0 string \x20\x20\x20\x20\x20\x20\x20\x20-:\x20\x20\x20\ 0:Source:
>&0 search/128 \x20\x20\x20\x20\x20\x20\x20\x20-:\x20\x20\x20\ 0:Graph:
>>&0 search/128 \x20\x20\x20\x20\x20\x20\x20\x20-:\x20\x20\x20\ 0:Data: GCOV coverage report
0 name certinfo
>0 der seq
>>&0 der set
>>>&0 der seq
>>>>&0 der obj_id3=550406
>>>>&0 der prt_str=x \b, countryName=%s
>>&0 der set
>>>&0 der seq
>>>>&0 der obj_id3=550408
>>>>&0 der utf8_str=x \b, stateOrProvinceName=%s
>>&0 der set
>>>&0 der seq
>>>>&0 der obj_id3=55040a
>>>>&0 der utf8_str=x \b, organizationName=%s
>>&0 der set
>>>&0 der seq
>>>>&0 der obj_id3=550403
>>>>&0 der utf8_str=x \b, commonName=%s
>>&0 der seq
0 search/1 FONT ASCII vfont text
0 short 0436 Berkeley vfont data
0 short 017001 byte-swapped Berkeley vfont data
+14
View File
@@ -0,0 +1,14 @@
--TEST--
Bug #77961 (finfo_open crafted magic parsing SIGABRT)
--SKIPIF--
<?php
if (!extension_loaded('fileinfo')) die('skip fileinfo extension not available');
?>
--FILE--
<?php
finfo_open(FILEINFO_NONE, __DIR__ . '/bug77961.magic');
?>
--EXPECTF--
Notice: finfo_open(): Warning: Expected numeric type got `indirect' in %s on line %d
Fatal error: fatal libmagic error in %s on line %d
+23
View File
@@ -555,6 +555,22 @@ void php_filter_validate_domain(PHP_INPUT_FILTER_PARAM_DECL) /* {{{ */
}
/* }}} */
static int is_userinfo_valid(zend_string *str)
{
const char *valid = "-._~!$&'()*+,;=:";
const char *p = ZSTR_VAL(str);
while (p - ZSTR_VAL(str) < ZSTR_LEN(str)) {
if (isalpha(*p) || isdigit(*p) || strchr(valid, *p)) {
p++;
} else if (*p == '%' && p - ZSTR_VAL(str) <= ZSTR_LEN(str) - 3 && isdigit(*(p+1)) && isxdigit(*(p+2))) {
p += 3;
} else {
return 0;
}
}
return 1;
}
void php_filter_validate_url(PHP_INPUT_FILTER_PARAM_DECL) /* {{{ */
{
php_url *url;
@@ -615,6 +631,13 @@ bad_url:
php_url_free(url);
RETURN_VALIDATION_FAILED
}
if (url->user != NULL && !is_userinfo_valid(url->user)) {
php_url_free(url);
RETURN_VALIDATION_FAILED
}
php_url_free(url);
}
/* }}} */
+15
View File
@@ -0,0 +1,15 @@
--TEST--
Bug #77423 (parse_url() will deliver a wrong host to user)
--FILE--
<?php
$urls = array(
"http://php.net\@aliyun.com/aaa.do",
"https://example.com\uFF03@bing.com",
);
foreach ($urls as $url) {
var_dump(filter_var($url, FILTER_VALIDATE_URL));
}
?>
--EXPECT--
bool(false)
bool(false)
+6
View File
@@ -1931,6 +1931,12 @@ static void ftp_ssl_shutdown(ftpbuf_t *ftp, php_socket_t fd, SSL *ssl_handle) {
/* SSL wants a write. Really odd. Let's bail out. */
done = 1;
break;
case SSL_ERROR_SYSCALL:
/* most likely the peer closed the connection without
sending a close_notify shutdown alert;
bail out to avoid raising a spurious warning */
done = 1;
break;
default:
if ((sslerror = ERR_get_error())) {
ERR_error_string_n(sslerror, buf, sizeof(buf));
+56
View File
@@ -3551,6 +3551,23 @@ PHP_FUNCTION(imap_fetch_overview)
}
/* }}} */
static zend_bool header_injection(zend_string *str, zend_bool adrlist)
{
char *p = ZSTR_VAL(str);
while ((p = strpbrk(p, "\r\n")) != NULL) {
if (!(p[0] == '\r' && p[1] == '\n')
/* adrlists do not support folding, but swallow trailing line breaks */
&& !((adrlist && p[1] == '\0')
/* other headers support folding */
|| !adrlist && (p[1] == ' ' || p[1] == '\t'))) {
return 1;
}
p++;
}
return 0;
}
/* {{{ proto string imap_mail_compose(array envelope, array body)
Create a MIME message based on given envelope and body sections */
PHP_FUNCTION(imap_mail_compose)
@@ -3571,6 +3588,13 @@ PHP_FUNCTION(imap_mail_compose)
return;
}
#define CHECK_HEADER_INJECTION(zstr, adrlist, header) \
if (header_injection(zstr, adrlist)) { \
php_error_docref(NULL, E_WARNING, "header injection attempt in " header); \
RETVAL_FALSE; \
goto done; \
}
#define PHP_RFC822_PARSE_ADRLIST(target, value) \
str_copy = estrndup(Z_STRVAL_P(value), Z_STRLEN_P(value)); \
rfc822_parse_adrlist(target, str_copy, "NO HOST"); \
@@ -3579,46 +3603,57 @@ PHP_FUNCTION(imap_mail_compose)
env = mail_newenvelope();
if ((pvalue = zend_hash_str_find(Z_ARRVAL_P(envelope), "remail", sizeof("remail") - 1)) != NULL) {
convert_to_string_ex(pvalue);
CHECK_HEADER_INJECTION(Z_STR_P(pvalue), 0, "remail");
env->remail = cpystr(Z_STRVAL_P(pvalue));
}
if ((pvalue = zend_hash_str_find(Z_ARRVAL_P(envelope), "return_path", sizeof("return_path") - 1)) != NULL) {
convert_to_string_ex(pvalue);
CHECK_HEADER_INJECTION(Z_STR_P(pvalue), 1, "return_path");
PHP_RFC822_PARSE_ADRLIST(&env->return_path, pvalue);
}
if ((pvalue = zend_hash_str_find(Z_ARRVAL_P(envelope), "date", sizeof("date") - 1)) != NULL) {
convert_to_string_ex(pvalue);
CHECK_HEADER_INJECTION(Z_STR_P(pvalue), 0, "date");
env->date = (unsigned char*)cpystr(Z_STRVAL_P(pvalue));
}
if ((pvalue = zend_hash_str_find(Z_ARRVAL_P(envelope), "from", sizeof("from") - 1)) != NULL) {
convert_to_string_ex(pvalue);
CHECK_HEADER_INJECTION(Z_STR_P(pvalue), 1, "from");
PHP_RFC822_PARSE_ADRLIST(&env->from, pvalue);
}
if ((pvalue = zend_hash_str_find(Z_ARRVAL_P(envelope), "reply_to", sizeof("reply_to") - 1)) != NULL) {
convert_to_string_ex(pvalue);
CHECK_HEADER_INJECTION(Z_STR_P(pvalue), 1, "reply_to");
PHP_RFC822_PARSE_ADRLIST(&env->reply_to, pvalue);
}
if ((pvalue = zend_hash_str_find(Z_ARRVAL_P(envelope), "in_reply_to", sizeof("in_reply_to") - 1)) != NULL) {
convert_to_string_ex(pvalue);
CHECK_HEADER_INJECTION(Z_STR_P(pvalue), 0, "in_reply_to");
env->in_reply_to = cpystr(Z_STRVAL_P(pvalue));
}
if ((pvalue = zend_hash_str_find(Z_ARRVAL_P(envelope), "subject", sizeof("subject") - 1)) != NULL) {
convert_to_string_ex(pvalue);
CHECK_HEADER_INJECTION(Z_STR_P(pvalue), 0, "subject");
env->subject = cpystr(Z_STRVAL_P(pvalue));
}
if ((pvalue = zend_hash_str_find(Z_ARRVAL_P(envelope), "to", sizeof("to") - 1)) != NULL) {
convert_to_string_ex(pvalue);
CHECK_HEADER_INJECTION(Z_STR_P(pvalue), 1, "to");
PHP_RFC822_PARSE_ADRLIST(&env->to, pvalue);
}
if ((pvalue = zend_hash_str_find(Z_ARRVAL_P(envelope), "cc", sizeof("cc") - 1)) != NULL) {
convert_to_string_ex(pvalue);
CHECK_HEADER_INJECTION(Z_STR_P(pvalue), 1, "cc");
PHP_RFC822_PARSE_ADRLIST(&env->cc, pvalue);
}
if ((pvalue = zend_hash_str_find(Z_ARRVAL_P(envelope), "bcc", sizeof("bcc") - 1)) != NULL) {
convert_to_string_ex(pvalue);
CHECK_HEADER_INJECTION(Z_STR_P(pvalue), 1, "bcc");
PHP_RFC822_PARSE_ADRLIST(&env->bcc, pvalue);
}
if ((pvalue = zend_hash_str_find(Z_ARRVAL_P(envelope), "message_id", sizeof("message_id") - 1)) != NULL) {
convert_to_string_ex(pvalue);
CHECK_HEADER_INJECTION(Z_STR_P(pvalue), 0, "message_id");
env->message_id=cpystr(Z_STRVAL_P(pvalue));
}
@@ -3629,6 +3664,7 @@ PHP_FUNCTION(imap_mail_compose)
ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(pvalue), env_data) {
custom_headers_param = mail_newbody_parameter();
convert_to_string_ex(env_data);
CHECK_HEADER_INJECTION(Z_STR_P(env_data), 0, "custom_headers");
custom_headers_param->value = (char *) fs_get(Z_STRLEN_P(env_data) + 1);
custom_headers_param->attribute = NULL;
memcpy(custom_headers_param->value, Z_STRVAL_P(env_data), Z_STRLEN_P(env_data) + 1);
@@ -3667,6 +3703,7 @@ PHP_FUNCTION(imap_mail_compose)
}
if ((pvalue = zend_hash_str_find(Z_ARRVAL_P(data), "charset", sizeof("charset") - 1)) != NULL) {
convert_to_string_ex(pvalue);
CHECK_HEADER_INJECTION(Z_STR_P(pvalue), 0, "body charset");
tmp_param = mail_newbody_parameter();
tmp_param->value = cpystr(Z_STRVAL_P(pvalue));
tmp_param->attribute = cpystr("CHARSET");
@@ -3679,9 +3716,11 @@ PHP_FUNCTION(imap_mail_compose)
SEPARATE_ARRAY(pvalue);
ZEND_HASH_FOREACH_STR_KEY_VAL(Z_ARRVAL_P(pvalue), key, disp_data) {
if (key == NULL) continue;
CHECK_HEADER_INJECTION(key, 0, "body disposition key");
disp_param = mail_newbody_parameter();
disp_param->attribute = cpystr(ZSTR_VAL(key));
convert_to_string_ex(disp_data);
CHECK_HEADER_INJECTION(Z_STR_P(disp_data), 0, "body disposition value");
disp_param->value = (char *) fs_get(Z_STRLEN_P(disp_data) + 1);
memcpy(disp_param->value, Z_STRVAL_P(disp_data), Z_STRLEN_P(disp_data) + 1);
disp_param->next = tmp_param;
@@ -3692,18 +3731,22 @@ PHP_FUNCTION(imap_mail_compose)
}
if ((pvalue = zend_hash_str_find(Z_ARRVAL_P(data), "subtype", sizeof("subtype") - 1)) != NULL) {
convert_to_string_ex(pvalue);
CHECK_HEADER_INJECTION(Z_STR_P(pvalue), 0, "body subtype");
bod->subtype = cpystr(Z_STRVAL_P(pvalue));
}
if ((pvalue = zend_hash_str_find(Z_ARRVAL_P(data), "id", sizeof("id") - 1)) != NULL) {
convert_to_string_ex(pvalue);
CHECK_HEADER_INJECTION(Z_STR_P(pvalue), 0, "body id");
bod->id = cpystr(Z_STRVAL_P(pvalue));
}
if ((pvalue = zend_hash_str_find(Z_ARRVAL_P(data), "description", sizeof("description") - 1)) != NULL) {
convert_to_string_ex(pvalue);
CHECK_HEADER_INJECTION(Z_STR_P(pvalue), 0, "body description");
bod->description = cpystr(Z_STRVAL_P(pvalue));
}
if ((pvalue = zend_hash_str_find(Z_ARRVAL_P(data), "disposition.type", sizeof("disposition.type") - 1)) != NULL) {
convert_to_string_ex(pvalue);
CHECK_HEADER_INJECTION(Z_STR_P(pvalue), 0, "body disposition.type");
bod->disposition.type = (char *) fs_get(Z_STRLEN_P(pvalue) + 1);
memcpy(bod->disposition.type, Z_STRVAL_P(pvalue), Z_STRLEN_P(pvalue)+1);
}
@@ -3713,9 +3756,11 @@ PHP_FUNCTION(imap_mail_compose)
SEPARATE_ARRAY(pvalue);
ZEND_HASH_FOREACH_STR_KEY_VAL(Z_ARRVAL_P(pvalue), key, disp_data) {
if (key == NULL) continue;
CHECK_HEADER_INJECTION(key, 0, "body type.parameters key");
disp_param = mail_newbody_parameter();
disp_param->attribute = cpystr(ZSTR_VAL(key));
convert_to_string_ex(disp_data);
CHECK_HEADER_INJECTION(Z_STR_P(disp_data), 0, "body type.parameters value");
disp_param->value = (char *) fs_get(Z_STRLEN_P(disp_data) + 1);
memcpy(disp_param->value, Z_STRVAL_P(disp_data), Z_STRLEN_P(disp_data) + 1);
disp_param->next = tmp_param;
@@ -3746,6 +3791,7 @@ PHP_FUNCTION(imap_mail_compose)
}
if ((pvalue = zend_hash_str_find(Z_ARRVAL_P(data), "md5", sizeof("md5") - 1)) != NULL) {
convert_to_string_ex(pvalue);
CHECK_HEADER_INJECTION(Z_STR_P(pvalue), 0, "body md5");
bod->md5 = cpystr(Z_STRVAL_P(pvalue));
}
} else if (Z_TYPE_P(data) == IS_ARRAY && topbod->type == TYPEMULTIPART) {
@@ -3778,6 +3824,7 @@ PHP_FUNCTION(imap_mail_compose)
}
if ((pvalue = zend_hash_str_find(Z_ARRVAL_P(data), "charset", sizeof("charset") - 1)) != NULL) {
convert_to_string_ex(pvalue);
CHECK_HEADER_INJECTION(Z_STR_P(pvalue), 0, "body charset");
tmp_param = mail_newbody_parameter();
tmp_param->value = (char *) fs_get(Z_STRLEN_P(pvalue) + 1);
memcpy(tmp_param->value, Z_STRVAL_P(pvalue), Z_STRLEN_P(pvalue) + 1);
@@ -3791,9 +3838,11 @@ PHP_FUNCTION(imap_mail_compose)
SEPARATE_ARRAY(pvalue);
ZEND_HASH_FOREACH_STR_KEY_VAL(Z_ARRVAL_P(pvalue), key, disp_data) {
if (key == NULL) continue;
CHECK_HEADER_INJECTION(key, 0, "body type.parameters key");
disp_param = mail_newbody_parameter();
disp_param->attribute = cpystr(ZSTR_VAL(key));
convert_to_string_ex(disp_data);
CHECK_HEADER_INJECTION(Z_STR_P(disp_data), 0, "body type.parameters value");
disp_param->value = (char *)fs_get(Z_STRLEN_P(disp_data) + 1);
memcpy(disp_param->value, Z_STRVAL_P(disp_data), Z_STRLEN_P(disp_data) + 1);
disp_param->next = tmp_param;
@@ -3804,18 +3853,22 @@ PHP_FUNCTION(imap_mail_compose)
}
if ((pvalue = zend_hash_str_find(Z_ARRVAL_P(data), "subtype", sizeof("subtype") - 1)) != NULL) {
convert_to_string_ex(pvalue);
CHECK_HEADER_INJECTION(Z_STR_P(pvalue), 0, "body subtype");
bod->subtype = cpystr(Z_STRVAL_P(pvalue));
}
if ((pvalue = zend_hash_str_find(Z_ARRVAL_P(data), "id", sizeof("id") - 1)) != NULL) {
convert_to_string_ex(pvalue);
CHECK_HEADER_INJECTION(Z_STR_P(pvalue), 0, "body id");
bod->id = cpystr(Z_STRVAL_P(pvalue));
}
if ((pvalue = zend_hash_str_find(Z_ARRVAL_P(data), "description", sizeof("description") - 1)) != NULL) {
convert_to_string_ex(pvalue);
CHECK_HEADER_INJECTION(Z_STR_P(pvalue), 0, "body description");
bod->description = cpystr(Z_STRVAL_P(pvalue));
}
if ((pvalue = zend_hash_str_find(Z_ARRVAL_P(data), "disposition.type", sizeof("disposition.type") - 1)) != NULL) {
convert_to_string_ex(pvalue);
CHECK_HEADER_INJECTION(Z_STR_P(pvalue), 0, "body disposition.type");
bod->disposition.type = (char *) fs_get(Z_STRLEN_P(pvalue) + 1);
memcpy(bod->disposition.type, Z_STRVAL_P(pvalue), Z_STRLEN_P(pvalue)+1);
}
@@ -3825,9 +3878,11 @@ PHP_FUNCTION(imap_mail_compose)
SEPARATE_ARRAY(pvalue);
ZEND_HASH_FOREACH_STR_KEY_VAL(Z_ARRVAL_P(pvalue), key, disp_data) {
if (key == NULL) continue;
CHECK_HEADER_INJECTION(key, 0, "body disposition key");
disp_param = mail_newbody_parameter();
disp_param->attribute = cpystr(ZSTR_VAL(key));
convert_to_string_ex(disp_data);
CHECK_HEADER_INJECTION(Z_STR_P(disp_data), 0, "body disposition value");
disp_param->value = (char *) fs_get(Z_STRLEN_P(disp_data) + 1);
memcpy(disp_param->value, Z_STRVAL_P(disp_data), Z_STRLEN_P(disp_data) + 1);
disp_param->next = tmp_param;
@@ -3858,6 +3913,7 @@ PHP_FUNCTION(imap_mail_compose)
}
if ((pvalue = zend_hash_str_find(Z_ARRVAL_P(data), "md5", sizeof("md5") - 1)) != NULL) {
convert_to_string_ex(pvalue);
CHECK_HEADER_INJECTION(Z_STR_P(pvalue), 0, "body md5");
bod->md5 = cpystr(Z_STRVAL_P(pvalue));
}
}
+37
View File
@@ -0,0 +1,37 @@
--TEST--
Bug #80710 (imap_mail_compose() header injection) - MIME Splitting Attack
--SKIPIF--
<?php
if (!extension_loaded("imap")) die("skip imap extension not available");
?>
--FILE--
<?php
$envelope["from"]= "joe@example.com\n From : X-INJECTED";
$envelope["to"] = "foo@example.com\nFrom: X-INJECTED";
$envelope["cc"] = "bar@example.com\nFrom: X-INJECTED";
$envelope["subject"] = "bar@example.com\n\n From : X-INJECTED";
$envelope["x-remail"] = "bar@example.com\nFrom: X-INJECTED";
$envelope["something"] = "bar@example.com\nFrom: X-INJECTED";
$part1["type"] = TYPEMULTIPART;
$part1["subtype"] = "mixed";
$part2["type"] = TYPEAPPLICATION;
$part2["encoding"] = ENCBINARY;
$part2["subtype"] = "octet-stream\nContent-Type: X-INJECTED";
$part2["description"] = "some file\nContent-Type: X-INJECTED";
$part2["contents.data"] = "ABC\nContent-Type: X-INJECTED";
$part3["type"] = TYPETEXT;
$part3["subtype"] = "plain";
$part3["description"] = "description3";
$part3["contents.data"] = "contents.data3\n\n\n\t";
$body[1] = $part1;
$body[2] = $part2;
$body[3] = $part3;
echo imap_mail_compose($envelope, $body);
?>
--EXPECTF--
Warning: imap_mail_compose(): header injection attempt in from in %s on line %d
+37
View File
@@ -0,0 +1,37 @@
--TEST--
Bug #80710 (imap_mail_compose() header injection) - Remail
--SKIPIF--
<?php
if (!extension_loaded("imap")) die("skip imap extension not available");
?>
--FILE--
<?php
$envelope["from"]= "joe@example.com\n From : X-INJECTED";
$envelope["to"] = "foo@example.com\nFrom: X-INJECTED";
$envelope["cc"] = "bar@example.com\nFrom: X-INJECTED";
$envelope["subject"] = "bar@example.com\n\n From : X-INJECTED";
$envelope["remail"] = "X-INJECTED-REMAIL: X-INJECTED\nFrom: X-INJECTED-REMAIL-FROM"; //<--- Injected as first hdr
$envelope["something"] = "bar@example.com\nFrom: X-INJECTED";
$part1["type"] = TYPEMULTIPART;
$part1["subtype"] = "mixed";
$part2["type"] = TYPEAPPLICATION;
$part2["encoding"] = ENCBINARY;
$part2["subtype"] = "octet-stream\nContent-Type: X-INJECTED";
$part2["description"] = "some file\nContent-Type: X-INJECTED";
$part2["contents.data"] = "ABC\nContent-Type: X-INJECTED";
$part3["type"] = TYPETEXT;
$part3["subtype"] = "plain";
$part3["description"] = "description3";
$part3["contents.data"] = "contents.data3\n\n\n\t";
$body[1] = $part1;
$body[2] = $part2;
$body[3] = $part3;
echo imap_mail_compose($envelope, $body);
?>
--EXPECTF--
Warning: imap_mail_compose(): header injection attempt in remail in %s on line %d
+4
View File
@@ -175,6 +175,7 @@ U_CFUNC double intl_zval_to_millis(zval *z, intl_error *err, const char *func)
return ZEND_NAN;
}
try_again:
switch (Z_TYPE_P(z)) {
case IS_STRING:
type = is_numeric_string(Z_STRVAL_P(z), Z_STRLEN_P(z), &lv, &rv, 0);
@@ -227,6 +228,9 @@ U_CFUNC double intl_zval_to_millis(zval *z, intl_error *err, const char *func)
efree(message);
}
break;
case IS_REFERENCE:
z = Z_REFVAL_P(z);
goto try_again;
default:
spprintf(&message, 0, "%s: invalid PHP type for date", func);
intl_errors_set(err, U_ILLEGAL_ARGUMENT_ERROR,
+11 -10
View File
@@ -46,25 +46,26 @@ extern "C" {
U_NAMESPACE_BEGIN
/**
* This class isolates our access to private internal methods of
* MessageFormat. It is never instantiated; it exists only for C++
* access management.
* ICU declares MessageFormatAdapter as a friend class of MessageFormat,
* to use as a backdoor for accessing private MessageFormat members.
* We use it for the same purpose here. Prefix the methods with php to
* avoid clashes with any definitions in ICU.
*/
class MessageFormatAdapter {
public:
static const Formattable::Type* getArgTypeList(const MessageFormat& m,
static const Formattable::Type* phpGetArgTypeList(const MessageFormat& m,
int32_t& count);
static const MessagePattern getMessagePattern(MessageFormat* m);
static const MessagePattern phpGetMessagePattern(MessageFormat* m);
};
const Formattable::Type*
MessageFormatAdapter::getArgTypeList(const MessageFormat& m,
MessageFormatAdapter::phpGetArgTypeList(const MessageFormat& m,
int32_t& count) {
return m.getArgTypeList(count);
}
const MessagePattern
MessageFormatAdapter::getMessagePattern(MessageFormat* m) {
MessageFormatAdapter::phpGetMessagePattern(MessageFormat* m) {
return m->msgPattern;
}
U_NAMESPACE_END
@@ -80,7 +81,7 @@ using icu::FieldPosition;
U_CFUNC int32_t umsg_format_arg_count(UMessageFormat *fmt)
{
int32_t fmt_count = 0;
MessageFormatAdapter::getArgTypeList(*(const MessageFormat*)fmt, fmt_count);
MessageFormatAdapter::phpGetArgTypeList(*(const MessageFormat*)fmt, fmt_count);
return fmt_count;
}
@@ -103,7 +104,7 @@ static HashTable *umsg_get_numeric_types(MessageFormatter_object *mfo,
return mfo->mf_data.arg_types;
}
const Formattable::Type *types = MessageFormatAdapter::getArgTypeList(
const Formattable::Type *types = MessageFormatAdapter::phpGetArgTypeList(
*(MessageFormat*)mfo->mf_data.umsgf, parts_count);
/* Hash table will store Formattable::Type objects directly,
@@ -288,7 +289,7 @@ static HashTable *umsg_get_types(MessageFormatter_object *mfo,
{
MessageFormat *mf = (MessageFormat *)mfo->mf_data.umsgf;
const MessagePattern mp = MessageFormatAdapter::getMessagePattern(mf);
const MessagePattern mp = MessageFormatAdapter::phpGetMessagePattern(mf);
return umsg_parse_format(mfo, mp, err);
}
+16
View File
@@ -0,0 +1,16 @@
--TEST--
Bug #80763 (msgfmt_format() does not accept DateTime references)
--SKIPIF--
<?php
if (!extension_loaded('intl')) die('skip intl extension not available');
?>
--FILE--
<?php
$today = new DateTime('2021-02-17 12:00:00');
$formatter = new \MessageFormatter('en_US', 'Today is {today, date, full}.');
$params = ['today' => $today];
array_walk($params, fn() => 1);
var_dump($formatter->format($params));
?>
--EXPECT--
string(38) "Today is Wednesday, February 17, 2021."
+49 -1
View File
@@ -409,6 +409,54 @@ php_libxml_input_buffer_create_filename(const char *URI, xmlCharEncoding enc)
return(NULL);
}
/* Check if there's been an external transport protocol with an encoding information */
if (enc == XML_CHAR_ENCODING_NONE) {
php_stream *s = (php_stream *) context;
if (Z_TYPE(s->wrapperdata) == IS_ARRAY) {
zval *header;
ZEND_HASH_FOREACH_VAL_IND(Z_ARRVAL(s->wrapperdata), header) {
const char buf[] = "Content-Type:";
if (Z_TYPE_P(header) == IS_STRING &&
!zend_binary_strncasecmp(Z_STRVAL_P(header), Z_STRLEN_P(header), buf, sizeof(buf)-1, sizeof(buf)-1)) {
char *needle = estrdup("charset=");
char *haystack = estrndup(Z_STRVAL_P(header), Z_STRLEN_P(header));
char *encoding = php_stristr(haystack, needle, Z_STRLEN_P(header), sizeof("charset=")-1);
if (encoding) {
char *end;
encoding += sizeof("charset=")-1;
if (*encoding == '"') {
encoding++;
}
end = strchr(encoding, ';');
if (end == NULL) {
end = encoding + strlen(encoding);
}
end--; /* end == encoding-1 isn't a buffer underrun */
while (*end == ' ' || *end == '\t') {
end--;
}
if (*end == '"') {
end--;
}
if (encoding >= end) continue;
*(end+1) = '\0';
enc = xmlParseCharEncoding(encoding);
if (enc <= XML_CHAR_ENCODING_NONE) {
enc = XML_CHAR_ENCODING_NONE;
}
}
efree(haystack);
efree(needle);
break; /* found content-type */
}
} ZEND_HASH_FOREACH_END();
}
}
/* Allocate the Input buffer front-end. */
ret = xmlAllocParserInputBuffer(enc);
if (ret != NULL) {
@@ -1134,7 +1182,7 @@ static PHP_FUNCTION(libxml_set_external_entity_loader)
/* {{{ Common functions shared by extensions */
int php_libxml_xmlCheckUTF8(const unsigned char *s)
{
int i;
size_t i;
unsigned char c;
for (i = 0; (c = s[i++]);) {
+38
View File
@@ -0,0 +1,38 @@
--TEST--
Bug #51903 (simplexml_load_file() doesn't use HTTP headers)
--SKIPIF--
<?php
if (!extension_loaded('simplexml')) die('skip simplexml extension not available');
if (@!include "./ext/standard/tests/http/server.inc") die('skip server.inc not available');
http_server_skipif('tcp://127.0.0.1:12342');
?>
--FILE--
<?php
require "./ext/standard/tests/http/server.inc";
$responses = [
"data://text/plain,HTTP/1.1 200 OK\r\n"
. "Content-Type: text/xml; charset=ISO-8859-1\r\n\r\n"
. "<?xml version=\"1.0\"?>\n"
. "<root>\xE4\xF6\xFC</root>\n",
"data://text/plain,HTTP/1.1 200 OK\r\n"
. "Content-Type: text/xml; charset=ISO-8859-1; foo=bar\r\n\r\n"
. "<?xml version=\"1.0\"?>\n"
. "<root>\xE4\xF6\xFC</root>\n",
"data://text/plain,HTTP/1.1 200 OK\r\n"
. "Content-Type: text/xml; charset=\"ISO-8859-1\" ; foo=bar\r\n\r\n"
. "<?xml version=\"1.0\"?>\n"
. "<root>\xE4\xF6\xFC</root>\n",
];
$pid = http_server('tcp://127.0.0.1:12342', $responses);
for ($i = 0; $i < count($responses); $i++) {
$sxe = simplexml_load_file('http://127.0.0.1:12342/');
echo "$sxe\n";
}
http_server_kill($pid);
?>
--EXPECT--
äöü
äöü
äöü
+17 -30
View File
@@ -1041,51 +1041,38 @@ PHP_FUNCTION(mysqli_stmt_construct)
zval *mysql_link;
MY_STMT *stmt;
MYSQLI_RESOURCE *mysqli_resource;
char *statement;
char *statement = NULL;
size_t statement_len;
switch (ZEND_NUM_ARGS())
{
case 1: /* mysql_stmt_init */
if (zend_parse_parameters(1, "O", &mysql_link, mysqli_link_class_entry)==FAILURE) {
return;
}
MYSQLI_FETCH_RESOURCE_CONN(mysql, mysql_link, MYSQLI_STATUS_VALID);
stmt = (MY_STMT *)ecalloc(1,sizeof(MY_STMT));
stmt->stmt = mysql_stmt_init(mysql->mysql);
break;
case 2:
if (zend_parse_parameters(2, "Os", &mysql_link, mysqli_link_class_entry, &statement, &statement_len)==FAILURE) {
return;
}
MYSQLI_FETCH_RESOURCE_CONN(mysql, mysql_link, MYSQLI_STATUS_VALID);
stmt = (MY_STMT *)ecalloc(1,sizeof(MY_STMT));
if ((stmt->stmt = mysql_stmt_init(mysql->mysql))) {
mysql_stmt_prepare(stmt->stmt, (char *)statement, statement_len);
}
break;
default:
WRONG_PARAM_COUNT;
break;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "O|s!", &mysql_link, mysqli_link_class_entry, &statement, &statement_len) == FAILURE) {
return;
}
MYSQLI_FETCH_RESOURCE_CONN(mysql, mysql_link, MYSQLI_STATUS_VALID);
if (!stmt->stmt) {
stmt = (MY_STMT *) ecalloc(1, sizeof(MY_STMT));
if (!(stmt->stmt = mysql_stmt_init(mysql->mysql))) {
efree(stmt);
RETURN_FALSE;
}
#ifndef MYSQLI_USE_MYSQLND
ZVAL_COPY(&stmt->link_handle, mysql_link);
#endif
mysqli_resource = (MYSQLI_RESOURCE *)ecalloc (1, sizeof(MYSQLI_RESOURCE));
mysqli_resource->ptr = (void *)stmt;
mysqli_resource->status = (ZEND_NUM_ARGS() == 1) ? MYSQLI_STATUS_INITIALIZED : MYSQLI_STATUS_VALID;
mysqli_resource->status = MYSQLI_STATUS_INITIALIZED;
MYSQLI_REGISTER_RESOURCE_EX(mysqli_resource, getThis());
if (statement) {
if(mysql_stmt_prepare(stmt->stmt, statement, statement_len)) {
MYSQLI_REPORT_STMT_ERROR(stmt->stmt);
RETURN_FALSE;
}
mysqli_resource->status = MYSQLI_STATUS_VALID;
}
}
/* }}} */
+10 -2
View File
@@ -1608,7 +1608,11 @@ PHP_FUNCTION(mysqli_next_result) {
}
MYSQLI_FETCH_RESOURCE_CONN(mysql, mysql_link, MYSQLI_STATUS_VALID);
RETURN_BOOL(!mysql_next_result(mysql->mysql));
if (mysql_next_result(mysql->mysql)) {
MYSQLI_REPORT_MYSQL_ERROR(mysql->mysql);
RETURN_FALSE;
}
RETURN_TRUE;
}
/* }}} */
@@ -1640,7 +1644,11 @@ PHP_FUNCTION(mysqli_stmt_next_result) {
}
MYSQLI_FETCH_RESOURCE_STMT(stmt, mysql_stmt, MYSQLI_STATUS_VALID);
RETURN_BOOL(!mysql_stmt_next_result(stmt->stmt));
if (mysql_stmt_next_result(stmt->stmt)) {
MYSQLI_REPORT_STMT_ERROR(stmt->stmt);
RETURN_FALSE;
}
RETURN_TRUE;
}
/* }}} */
#endif
+38 -38
View File
@@ -8,55 +8,55 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
require_once("connect.inc");
require_once("connect.inc");
$test = "";
$test = "";
/*** test mysqli_connect localhost:port ***/
$link = my_mysqli_connect($host, $user, $passwd, "", $port, $socket);
$test .= ($link) ? "1" : "0";
mysqli_close($link);
/*** test mysqli_connect localhost:port ***/
$link = my_mysqli_connect($host, $user, $passwd, "", $port, $socket);
$test .= ($link) ? "1" : "0";
mysqli_close($link);
/*** test mysqli_real_connect ***/
$link = mysqli_init();
$test.= (my_mysqli_real_connect($link, $host, $user, $passwd, "", $port, $socket) )
? "1" : "0";
mysqli_close($link);
/*** test mysqli_real_connect ***/
$link = mysqli_init();
$test.= (my_mysqli_real_connect($link, $host, $user, $passwd, "", $port, $socket) )
? "1" : "0";
mysqli_close($link);
/*** test mysqli_real_connect with db ***/
$link = mysqli_init();
$test .= (my_mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket))
? "1" : "0";
mysqli_close($link);
/*** test mysqli_real_connect with db ***/
$link = mysqli_init();
$test .= (my_mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket))
? "1" : "0";
mysqli_close($link);
/*** test mysqli_real_connect with port ***/
$link = mysqli_init();
$test .= (my_mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket))
? "1":"0";
mysqli_close($link);
/*** test mysqli_real_connect with port ***/
$link = mysqli_init();
$test .= (my_mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket))
? "1":"0";
mysqli_close($link);
/* temporary addition for Kent's setup, Win32 box */
for ($i = 0; $i < 10; $i++) {
if (!$link = mysqli_init())
printf("[001 + %d] mysqli_init() failed, [%d] %s\n", $i, mysqli_connect_errno(), mysqli_connect_error());
/* temporary addition for Kent's setup, Win32 box */
for ($i = 0; $i < 10; $i++) {
if (!$link = mysqli_init())
printf("[001 + %d] mysqli_init() failed, [%d] %s\n", $i, mysqli_connect_errno(), mysqli_connect_error());
if (!my_mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket))
printf("[002 + %d] mysqli_real_connect() failed, [%d] %s\n", $i, mysqli_connect_errno(), mysqli_connect_error());
if (!my_mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket))
printf("[002 + %d] mysqli_real_connect() failed, [%d] %s\n", $i, mysqli_connect_errno(), mysqli_connect_error());
mysqli_close($link);
}
mysqli_close($link);
}
/*** test mysqli_real_connect compressed ***/
/*
$link = mysqli_init();
$test .= (my_mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket, MYSQLI_CLIENT_COMPRESS))
? "1" : "0";
mysqli_close($link);
/*** test mysqli_real_connect compressed ***/
/*
$link = mysqli_init();
$test .= (my_mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket, MYSQLI_CLIENT_COMPRESS))
? "1" : "0";
mysqli_close($link);
*/
/* todo ssl connections */
/* todo ssl connections */
var_dump($test);
print "done!";
var_dump($test);
print "done!";
?>
--EXPECTF--
%s(4) "1111"
+29 -29
View File
@@ -7,44 +7,44 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
require_once("connect.inc");
require_once("connect.inc");
/*** test mysqli_connect 127.0.0.1 ***/
if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
printf("[001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
/*** test mysqli_connect 127.0.0.1 ***/
if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
printf("[001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
if (!mysqli_query($link, "DROP TABLE IF EXISTS test_fetch_null"))
printf("[002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
if (!mysqli_query($link, "DROP TABLE IF EXISTS test_fetch_null"))
printf("[002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
$rc = mysqli_query($link,"CREATE TABLE test_fetch_null(col1 tinyint, col2 smallint,
col3 int, col4 bigint,
col5 float, col6 double,
col7 date, col8 time,
col9 varbinary(10),
col10 varchar(50),
col11 char(20)) ENGINE=" . $engine);
$rc = mysqli_query($link,"CREATE TABLE test_fetch_null(col1 tinyint, col2 smallint,
col3 int, col4 bigint,
col5 float, col6 double,
col7 date, col8 time,
col9 varbinary(10),
col10 varchar(50),
col11 char(20)) ENGINE=" . $engine);
if (!$rc)
printf("[003] Cannot create table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
if (!$rc)
printf("[003] Cannot create table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
$rc = mysqli_query($link, "INSERT INTO test_fetch_null(col1,col10, col11) VALUES(1,'foo1', 1000),(2,'foo2', 88),(3,'foo3', 389789)");
if (!$rc)
printf("[004] Cannot insert records, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
$rc = mysqli_query($link, "INSERT INTO test_fetch_null(col1,col10, col11) VALUES(1,'foo1', 1000),(2,'foo2', 88),(3,'foo3', 389789)");
if (!$rc)
printf("[004] Cannot insert records, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
$stmt = mysqli_prepare($link, "SELECT col1, col2, col3, col4, col5, col6, col7, col8, col9, col10, col11 from test_fetch_null ORDER BY col1");
mysqli_stmt_bind_result($stmt, $c1, $c2, $c3, $c4, $c5, $c6, $c7, $c8, $c9, $c10, $c11);
mysqli_stmt_execute($stmt);
$stmt = mysqli_prepare($link, "SELECT col1, col2, col3, col4, col5, col6, col7, col8, col9, col10, col11 from test_fetch_null ORDER BY col1");
mysqli_stmt_bind_result($stmt, $c1, $c2, $c3, $c4, $c5, $c6, $c7, $c8, $c9, $c10, $c11);
mysqli_stmt_execute($stmt);
mysqli_stmt_fetch($stmt);
mysqli_stmt_fetch($stmt);
$test = array($c1,$c2,$c3,$c4,$c5,$c6,$c7,$c8,$c9,$c10,$c11);
$test = array($c1,$c2,$c3,$c4,$c5,$c6,$c7,$c8,$c9,$c10,$c11);
var_dump($test);
var_dump($test);
mysqli_stmt_close($stmt);
@mysqli_query($link, "DROP TABLE IF EXISTS test_fetch_null");
mysqli_close($link);
print "done!";
mysqli_stmt_close($stmt);
@mysqli_query($link, "DROP TABLE IF EXISTS test_fetch_null");
mysqli_close($link);
print "done!";
?>
--CLEAN--
<?php
@@ -53,7 +53,7 @@ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
printf("[c001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
if (!mysqli_query($link, "DROP TABLE IF EXISTS test_fetch_null"))
printf("[c002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
printf("[c002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
mysqli_close($link);
?>
+54 -54
View File
@@ -7,70 +7,70 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
require_once("connect.inc");
require_once("connect.inc");
$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
mysqli_query($link, "SET sql_mode=''");
mysqli_query($link, "SET sql_mode=''");
if (!mysqli_query($link,"DROP TABLE IF EXISTS test_bind_result"))
printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
if (!mysqli_query($link,"DROP TABLE IF EXISTS test_bind_result"))
printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
$rc = @mysqli_query($link,"CREATE TABLE test_bind_result(
c1 date,
c2 time,
c3 timestamp(14),
c4 year,
c5 datetime,
c6 timestamp(4),
c7 timestamp(6)) ENGINE=" . $engine);
$rc = @mysqli_query($link,"CREATE TABLE test_bind_result(
c1 date,
c2 time,
c3 timestamp(14),
c4 year,
c5 datetime,
c6 timestamp(4),
c7 timestamp(6)) ENGINE=" . $engine);
/*
Seems that not all MySQL 6.0 installations use defaults that ignore the display widths.
From the manual:
From MySQL 4.1.0 on, TIMESTAMP display format differs from that of earlier MySQL releases:
[...]
Display widths (used as described in the preceding section) are no longer supported.
In other words, for declarations such as TIMESTAMP(2), TIMESTAMP(4), and so on,
the display width is ignored.
[...]
*/
if (!$rc)
$rc = @mysqli_query($link,"CREATE TABLE test_bind_result(
c1 date,
c2 time,
c3 timestamp,
c4 year,
c5 datetime,
c6 timestamp,
c7 timestamp) ENGINE=" . $engine);
/*
Seems that not all MySQL 6.0 installations use defaults that ignore the display widths.
From the manual:
From MySQL 4.1.0 on, TIMESTAMP display format differs from that of earlier MySQL releases:
[...]
Display widths (used as described in the preceding section) are no longer supported.
In other words, for declarations such as TIMESTAMP(2), TIMESTAMP(4), and so on,
the display width is ignored.
[...]
*/
if (!$rc)
$rc = @mysqli_query($link,"CREATE TABLE test_bind_result(
c1 date,
c2 time,
c3 timestamp,
c4 year,
c5 datetime,
c6 timestamp,
c7 timestamp) ENGINE=" . $engine);
if (!$rc)
printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
if (!$rc)
printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
$rc = mysqli_query($link, "INSERT INTO test_bind_result VALUES(
'2002-01-02',
'12:49:00',
'2002-01-02 17:46:59',
2010,
'2010-07-10',
'2020','1999-12-29')");
if (!$rc)
printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
$rc = mysqli_query($link, "INSERT INTO test_bind_result VALUES(
'2002-01-02',
'12:49:00',
'2002-01-02 17:46:59',
2010,
'2010-07-10',
'2020','1999-12-29')");
if (!$rc)
printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
$stmt = mysqli_prepare($link, "SELECT c1, c2, c3, c4, c5, c6, c7 FROM test_bind_result");
mysqli_stmt_bind_result($stmt, $c1, $c2, $c3, $c4, $c5, $c6, $c7);
mysqli_stmt_execute($stmt);
mysqli_stmt_fetch($stmt);
$stmt = mysqli_prepare($link, "SELECT c1, c2, c3, c4, c5, c6, c7 FROM test_bind_result");
mysqli_stmt_bind_result($stmt, $c1, $c2, $c3, $c4, $c5, $c6, $c7);
mysqli_stmt_execute($stmt);
mysqli_stmt_fetch($stmt);
$test = array($c1,$c2,$c3,$c4,$c5,$c6,$c7);
$test = array($c1,$c2,$c3,$c4,$c5,$c6,$c7);
var_dump($test);
var_dump($test);
mysqli_stmt_close($stmt);
mysqli_query($link, "DROP TABLE IF EXISTS test_bind_result");
mysqli_close($link);
print "done!";
mysqli_stmt_close($stmt);
mysqli_query($link, "DROP TABLE IF EXISTS test_bind_result");
mysqli_close($link);
print "done!";
?>
--CLEAN--
<?php
@@ -79,7 +79,7 @@ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
printf("[c001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
if (!mysqli_query($link, "DROP TABLE IF EXISTS test_bind_result"))
printf("[c002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
printf("[c002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
mysqli_close($link);
?>
+32 -32
View File
@@ -7,48 +7,48 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
include ("connect.inc");
include ("connect.inc");
/*** test mysqli_connect 127.0.0.1 ***/
$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
/*** test mysqli_connect 127.0.0.1 ***/
$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
mysqli_select_db($link, $db);
mysqli_select_db($link, $db);
if (!mysqli_query($link,"DROP TABLE IF EXISTS test_bind_fetch"))
printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
if (!mysqli_query($link,"DROP TABLE IF EXISTS test_bind_fetch"))
printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
if (!mysqli_query($link,"CREATE TABLE test_bind_fetch(c1 char(10), c2 text) ENGINE=" . $engine))
printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
if (!mysqli_query($link,"CREATE TABLE test_bind_fetch(c1 char(10), c2 text) ENGINE=" . $engine))
printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
if (!mysqli_query($link, "INSERT INTO test_bind_fetch VALUES ('1234567890', 'this is a test0')"))
printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
if (!mysqli_query($link, "INSERT INTO test_bind_fetch VALUES ('1234567890', 'this is a test0')"))
printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
if (!mysqli_query($link, "INSERT INTO test_bind_fetch VALUES ('1234567891', 'this is a test1')"))
printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
if (!mysqli_query($link, "INSERT INTO test_bind_fetch VALUES ('1234567891', 'this is a test1')"))
printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
if (!mysqli_query($link, "INSERT INTO test_bind_fetch VALUES ('1234567892', 'this is a test2')"))
printf("[005] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
if (!mysqli_query($link, "INSERT INTO test_bind_fetch VALUES ('1234567892', 'this is a test2')"))
printf("[005] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
if (!mysqli_query($link, "INSERT INTO test_bind_fetch VALUES ('1234567893', 'this is a test3')"))
printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
if (!mysqli_query($link, "INSERT INTO test_bind_fetch VALUES ('1234567893', 'this is a test3')"))
printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
if (!$stmt = mysqli_prepare($link, "SELECT * FROM test_bind_fetch ORDER BY c1"))
printf("[007] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
if (!$stmt = mysqli_prepare($link, "SELECT * FROM test_bind_fetch ORDER BY c1"))
printf("[007] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
$c1 = $c2 = NULL;
mysqli_stmt_bind_result($stmt, $c1, $c2);
mysqli_stmt_execute($stmt);
$i = 4;
while ($i--) {
mysqli_stmt_fetch($stmt);
$test = array($c1, $c2);
var_dump($test);
}
$c1 = $c2 = NULL;
mysqli_stmt_bind_result($stmt, $c1, $c2);
mysqli_stmt_execute($stmt);
$i = 4;
while ($i--) {
mysqli_stmt_fetch($stmt);
$test = array($c1, $c2);
var_dump($test);
}
mysqli_stmt_close($stmt);
mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch");
mysqli_close($link);
print "done!";
mysqli_stmt_close($stmt);
mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch");
mysqli_close($link);
print "done!";
?>
--CLEAN--
<?php
@@ -57,7 +57,7 @@ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
printf("[c001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
if (!mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch"))
printf("[c002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
printf("[c002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
mysqli_close($link);
?>
+23 -23
View File
@@ -7,38 +7,38 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
require_once("connect.inc");
require_once("connect.inc");
/*** test mysqli_connect 127.0.0.1 ***/
$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
/*** test mysqli_connect 127.0.0.1 ***/
$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
if (!mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch"))
printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
if (!mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch"))
printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
if (!mysqli_query($link, "CREATE TABLE test_bind_fetch(c1 char(10), c2 text) ENGINE=" . $engine))
printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
if (!mysqli_query($link, "CREATE TABLE test_bind_fetch(c1 char(10), c2 text) ENGINE=" . $engine))
printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
$a = str_repeat("A1", 32000);
$a = str_repeat("A1", 32000);
mysqli_query($link, "INSERT INTO test_bind_fetch VALUES ('1234567890', '$a')");
mysqli_query($link, "INSERT INTO test_bind_fetch VALUES ('1234567890', '$a')");
$stmt = mysqli_prepare($link, "SELECT * FROM test_bind_fetch");
mysqli_stmt_bind_result($stmt, $c1, $c2);
mysqli_stmt_execute($stmt);
mysqli_stmt_fetch($stmt);
$stmt = mysqli_prepare($link, "SELECT * FROM test_bind_fetch");
mysqli_stmt_bind_result($stmt, $c1, $c2);
mysqli_stmt_execute($stmt);
mysqli_stmt_fetch($stmt);
$test[] = $c1;
$test[] = ($a == $c2) ? "32K String ok" : "32K String failed";
$test[] = $c1;
$test[] = ($a == $c2) ? "32K String ok" : "32K String failed";
var_dump($test);
var_dump($test);
/* this will crash with libmysql from PHP 5.0.6 (or earlier) to 5.3.0 */
mysqli_stmt_fetch($stmt);
/* this will crash with libmysql from PHP 5.0.6 (or earlier) to 5.3.0 */
mysqli_stmt_fetch($stmt);
mysqli_stmt_close($stmt);
mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch");
mysqli_close($link);
print "done!";
mysqli_stmt_close($stmt);
mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch");
mysqli_close($link);
print "done!";
?>
--CLEAN--
<?php
@@ -47,7 +47,7 @@ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
printf("[c001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
if (!mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch"))
printf("[c002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
printf("[c002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
mysqli_close($link);
?>
+29 -29
View File
@@ -7,43 +7,43 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
require_once("connect.inc");
require_once("connect.inc");
/*** test mysqli_connect 127.0.0.1 ***/
$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
/*** test mysqli_connect 127.0.0.1 ***/
$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
if (!mysqli_query($link, "SET sql_mode=''"))
printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
if (!mysqli_query($link, "SET sql_mode=''"))
printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
if (!mysqli_query($link,"DROP TABLE IF EXISTS test_bind_fetch"))
printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
if (!mysqli_query($link,"DROP TABLE IF EXISTS test_bind_fetch"))
printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
$rc = mysqli_query($link,"CREATE TABLE test_bind_fetch(c1 int unsigned,
c2 int unsigned,
c3 int,
c4 int,
c5 int,
c6 int unsigned,
c7 int) ENGINE=" . $engine);
if (!$rc)
printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
$rc = mysqli_query($link,"CREATE TABLE test_bind_fetch(c1 int unsigned,
c2 int unsigned,
c3 int,
c4 int,
c5 int,
c6 int unsigned,
c7 int) ENGINE=" . $engine);
if (!$rc)
printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
if (!mysqli_query($link, "INSERT INTO test_bind_fetch VALUES (-23,35999,NULL,-500,-9999999,-0,0)"))
printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
if (!mysqli_query($link, "INSERT INTO test_bind_fetch VALUES (-23,35999,NULL,-500,-9999999,-0,0)"))
printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
$stmt = mysqli_prepare($link, "SELECT * FROM test_bind_fetch");
mysqli_stmt_bind_result($stmt, $c1, $c2, $c3, $c4, $c5, $c6, $c7);
mysqli_stmt_execute($stmt);
mysqli_stmt_fetch($stmt);
$stmt = mysqli_prepare($link, "SELECT * FROM test_bind_fetch");
mysqli_stmt_bind_result($stmt, $c1, $c2, $c3, $c4, $c5, $c6, $c7);
mysqli_stmt_execute($stmt);
mysqli_stmt_fetch($stmt);
$test = array($c1,$c2,$c3,$c4,$c5,$c6,$c7);
$test = array($c1,$c2,$c3,$c4,$c5,$c6,$c7);
var_dump($test);
var_dump($test);
mysqli_stmt_close($stmt);
mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch");
mysqli_close($link);
print "done!";
mysqli_stmt_close($stmt);
mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch");
mysqli_close($link);
print "done!";
?>
--CLEAN--
<?php
@@ -52,7 +52,7 @@ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
printf("[c001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
if (!mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch"))
printf("[c002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
printf("[c002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
mysqli_close($link);
?>
+29 -29
View File
@@ -7,43 +7,43 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
require_once("connect.inc");
require_once("connect.inc");
/*** test mysqli_connect 127.0.0.1 ***/
$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
/*** test mysqli_connect 127.0.0.1 ***/
$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
if (!mysqli_query($link, "SET sql_mode=''"))
printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
if (!mysqli_query($link, "SET sql_mode=''"))
printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
if (!mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch"))
printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
if (!mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch"))
printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
$rc = mysqli_query($link, "CREATE TABLE test_bind_fetch(c1 smallint unsigned,
c2 smallint unsigned,
c3 smallint,
c4 smallint,
c5 smallint,
c6 smallint unsigned,
c7 smallint) ENGINE=" . $engine);
if (!$rc)
printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
$rc = mysqli_query($link, "CREATE TABLE test_bind_fetch(c1 smallint unsigned,
c2 smallint unsigned,
c3 smallint,
c4 smallint,
c5 smallint,
c6 smallint unsigned,
c7 smallint) ENGINE=" . $engine);
if (!$rc)
printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
if (!mysqli_query($link, "INSERT INTO test_bind_fetch VALUES (-23,35999,NULL,-500,-9999999,+30,0)"))
printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
if (!mysqli_query($link, "INSERT INTO test_bind_fetch VALUES (-23,35999,NULL,-500,-9999999,+30,0)"))
printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
$stmt = mysqli_prepare($link, "SELECT * FROM test_bind_fetch");
mysqli_stmt_bind_result($stmt, $c1, $c2, $c3, $c4, $c5, $c6, $c7);
mysqli_stmt_execute($stmt);
mysqli_stmt_fetch($stmt);
$stmt = mysqli_prepare($link, "SELECT * FROM test_bind_fetch");
mysqli_stmt_bind_result($stmt, $c1, $c2, $c3, $c4, $c5, $c6, $c7);
mysqli_stmt_execute($stmt);
mysqli_stmt_fetch($stmt);
$test = array($c1,$c2,$c3,$c4,$c5,$c6,$c7);
$test = array($c1,$c2,$c3,$c4,$c5,$c6,$c7);
var_dump($test);
var_dump($test);
mysqli_stmt_close($stmt);
mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch");
mysqli_close($link);
print "done!";
mysqli_stmt_close($stmt);
mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch");
mysqli_close($link);
print "done!";
?>
--CLEAN--
<?php
@@ -52,7 +52,7 @@ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
printf("[c001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
if (!mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch"))
printf("[c002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
printf("[c002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
mysqli_close($link);
?>
+29 -29
View File
@@ -7,43 +7,43 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
require_once("connect.inc");
require_once("connect.inc");
/*** test mysqli_connect 127.0.0.1 ***/
$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
/*** test mysqli_connect 127.0.0.1 ***/
$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
if (!mysqli_query($link, "SET sql_mode=''"))
printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
if (!mysqli_query($link, "SET sql_mode=''"))
printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
if (!mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch"))
printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
if (!mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch"))
printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
$rc = mysqli_query($link, "CREATE TABLE test_bind_fetch(c1 tinyint,
c2 tinyint unsigned,
c3 tinyint not NULL,
c4 tinyint,
c5 tinyint,
c6 tinyint unsigned,
c7 tinyint) ENGINE=" . $engine);
if (!$rc)
printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
$rc = mysqli_query($link, "CREATE TABLE test_bind_fetch(c1 tinyint,
c2 tinyint unsigned,
c3 tinyint not NULL,
c4 tinyint,
c5 tinyint,
c6 tinyint unsigned,
c7 tinyint) ENGINE=" . $engine);
if (!$rc)
printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
if (!mysqli_query($link, "INSERT INTO test_bind_fetch VALUES (-23,300,0,-100,-127,+30,0)"))
printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
if (!mysqli_query($link, "INSERT INTO test_bind_fetch VALUES (-23,300,0,-100,-127,+30,0)"))
printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
$stmt = mysqli_prepare($link, "SELECT * FROM test_bind_fetch");
mysqli_stmt_bind_result($stmt, $c1, $c2, $c3, $c4, $c5, $c6, $c7);
mysqli_stmt_execute($stmt);
mysqli_stmt_fetch($stmt);
$stmt = mysqli_prepare($link, "SELECT * FROM test_bind_fetch");
mysqli_stmt_bind_result($stmt, $c1, $c2, $c3, $c4, $c5, $c6, $c7);
mysqli_stmt_execute($stmt);
mysqli_stmt_fetch($stmt);
$test = array($c1,$c2,$c3,$c4,$c5,$c6,$c7);
$test = array($c1,$c2,$c3,$c4,$c5,$c6,$c7);
var_dump($test);
var_dump($test);
mysqli_stmt_close($stmt);
mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch");
mysqli_close($link);
print "done!";
mysqli_stmt_close($stmt);
mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch");
mysqli_close($link);
print "done!";
?>
--CLEAN--
<?php
@@ -52,7 +52,7 @@ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
printf("[c001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
if (!mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch"))
printf("[c002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
printf("[c002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
mysqli_close($link);
?>
+60 -60
View File
@@ -2,81 +2,81 @@
mysqli fetch bigint values (ok to fail with 4.1.x)
--SKIPIF--
<?php
if (PHP_INT_SIZE == 8) {
echo 'skip test valid only for 32bit systems';
exit;
}
require_once('skipif.inc');
require_once('skipifconnectfailure.inc');
if (PHP_INT_SIZE == 8) {
echo 'skip test valid only for 32bit systems';
exit;
}
require_once('skipif.inc');
require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
require_once("connect.inc");
require_once("connect.inc");
/*** test mysqli_connect 127.0.0.1 ***/
$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
/*** test mysqli_connect 127.0.0.1 ***/
$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
if (!mysqli_query($link, "SET sql_mode=''"))
printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
if (!mysqli_query($link, "SET sql_mode=''"))
printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
if (!mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch"))
printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
if (!mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch"))
printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
$rc = mysqli_query($link,"CREATE TABLE test_bind_fetch(c1 bigint default 5,
c2 bigint,
c3 bigint not NULL,
c4 bigint unsigned,
c5 bigint unsigned,
c6 bigint unsigned,
c7 bigint unsigned,
c8 bigint unsigned) ENGINE=" . $engine);
if (!$rc)
printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
$rc = mysqli_query($link,"CREATE TABLE test_bind_fetch(c1 bigint default 5,
c2 bigint,
c3 bigint not NULL,
c4 bigint unsigned,
c5 bigint unsigned,
c6 bigint unsigned,
c7 bigint unsigned,
c8 bigint unsigned) ENGINE=" . $engine);
if (!$rc)
printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
$rc = mysqli_query($link, "INSERT INTO test_bind_fetch (c2,c3,c4,c5,c6,c7,c8) ".
"VALUES (-23,4.0,33333333333333,0,-333333333333,99.9,1234)");
if (!$rc)
printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
$rc = mysqli_query($link, "INSERT INTO test_bind_fetch (c2,c3,c4,c5,c6,c7,c8) ".
"VALUES (-23,4.0,33333333333333,0,-333333333333,99.9,1234)");
if (!$rc)
printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
$stmt = mysqli_prepare($link, "SELECT * FROM test_bind_fetch");
mysqli_stmt_bind_result($stmt, $c1, $c2, $c3, $c4, $c5, $c6, $c7, $c8);
mysqli_stmt_execute($stmt);
$rc = mysqli_stmt_fetch($stmt);
$stmt = mysqli_prepare($link, "SELECT * FROM test_bind_fetch");
mysqli_stmt_bind_result($stmt, $c1, $c2, $c3, $c4, $c5, $c6, $c7, $c8);
mysqli_stmt_execute($stmt);
$rc = mysqli_stmt_fetch($stmt);
if (mysqli_get_server_version($link) < 50000) {
// 4.1 is faulty and will return big number for $c6
if ($c6 == "18446743740376218283") {
$c6 = 0;
}
}
$c8 = 4567;// change this to test how mysqli/mysqlnd handles is_ref changing
$test = array($c1,$c2,$c3,$c4,$c5,$c6,$c7,$c8);
if (mysqli_get_server_version($link) < 50000) {
// 4.1 is faulty and will return big number for $c6
if ($c6 == "18446743740376218283") {
$c6 = 0;
}
}
$c8 = 4567;// change this to test how mysqli/mysqlnd handles is_ref changing
$test = array($c1,$c2,$c3,$c4,$c5,$c6,$c7,$c8);
var_dump($test);
var_dump($test);
mysqli_stmt_close($stmt);
mysqli_stmt_close($stmt);
if (!mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch_uint"))
printf("[005] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
$rc = mysqli_query($link, "CREATE TABLE test_bind_fetch_uint(c1 integer unsigned, c2 integer unsigned) ENGINE=" . $engine);
if (!$rc)
printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
if (!mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch_uint"))
printf("[005] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
$rc = mysqli_query($link, "CREATE TABLE test_bind_fetch_uint(c1 integer unsigned, c2 integer unsigned) ENGINE=" . $engine);
if (!$rc)
printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
if (!mysqli_query($link, "INSERT INTO test_bind_fetch_uint (c1,c2) VALUES (20123456, 3123456789)"))
printf("[007] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
if (!mysqli_query($link, "INSERT INTO test_bind_fetch_uint (c1,c2) VALUES (20123456, 3123456789)"))
printf("[007] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
$stmt = mysqli_prepare($link, "SELECT * FROM test_bind_fetch_uint");
mysqli_stmt_bind_result($stmt, $c1, $c2);
mysqli_stmt_execute($stmt);
$rc = mysqli_stmt_fetch($stmt);
$stmt = mysqli_prepare($link, "SELECT * FROM test_bind_fetch_uint");
mysqli_stmt_bind_result($stmt, $c1, $c2);
mysqli_stmt_execute($stmt);
$rc = mysqli_stmt_fetch($stmt);
echo $c1, "\n", $c2, "\n";
echo $c1, "\n", $c2, "\n";
mysqli_stmt_close($stmt);
mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch");
mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch_uint");
mysqli_close($link);
print "done!";
mysqli_stmt_close($stmt);
mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch");
mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch_uint");
mysqli_close($link);
print "done!";
?>
--CLEAN--
<?php
@@ -85,10 +85,10 @@ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
printf("[c001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
if (!mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch"))
printf("[002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
printf("[002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
if (!mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch_uint"))
printf("[002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
printf("[002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
mysqli_close($link);
?>
+29 -29
View File
@@ -9,44 +9,44 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
require_once("connect.inc");
require_once("connect.inc");
/*** test mysqli_connect 127.0.0.1 ***/
$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
/*** test mysqli_connect 127.0.0.1 ***/
$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
if (!mysqli_query($link, "SET sql_mode=''"))
printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
if (!mysqli_query($link, "SET sql_mode=''"))
printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
if (!mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch"))
printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
if (!mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch"))
printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
$rc = mysqli_query($link, "CREATE TABLE test_bind_fetch(c1 float(3),
c2 float,
c3 float unsigned,
c4 float,
c5 float,
c6 float,
c7 float(10) unsigned) ENGINE=" . $engine);
if (!$rc)
printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
$rc = mysqli_query($link, "CREATE TABLE test_bind_fetch(c1 float(3),
c2 float,
c3 float unsigned,
c4 float,
c5 float,
c6 float,
c7 float(10) unsigned) ENGINE=" . $engine);
if (!$rc)
printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
mysqli_query($link, "INSERT INTO test_bind_fetch (c1,c2,c3,c4,c5,c6,c7) VALUES (3.1415926535,-0.000001, -5, 999999999999,
sin(0.6), 1.00000000000001, 888888888888888)");
mysqli_query($link, "INSERT INTO test_bind_fetch (c1,c2,c3,c4,c5,c6,c7) VALUES (3.1415926535,-0.000001, -5, 999999999999,
sin(0.6), 1.00000000000001, 888888888888888)");
$stmt = mysqli_prepare($link, "SELECT * FROM test_bind_fetch");
mysqli_stmt_bind_result($stmt, $c1, $c2, $c3, $c4, $c5, $c6, $c7);
mysqli_stmt_execute($stmt);
mysqli_stmt_fetch($stmt);
$stmt = mysqli_prepare($link, "SELECT * FROM test_bind_fetch");
mysqli_stmt_bind_result($stmt, $c1, $c2, $c3, $c4, $c5, $c6, $c7);
mysqli_stmt_execute($stmt);
mysqli_stmt_fetch($stmt);
$test = array($c1,$c2,$c3,$c4,$c5,$c6,$c7);
$test = array($c1,$c2,$c3,$c4,$c5,$c6,$c7);
var_dump($test);
var_dump($test);
mysqli_stmt_close($stmt);
mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch");
mysqli_close($link);
print "done!";
mysqli_stmt_close($stmt);
mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch");
mysqli_close($link);
print "done!";
?>
--CLEAN--
<?php
@@ -55,7 +55,7 @@ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
printf("[c001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
if (!mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch"))
printf("[c002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
printf("[c002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
mysqli_close($link);
?>
+28 -28
View File
@@ -9,41 +9,41 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
require_once("connect.inc");
require_once("connect.inc");
/*** test mysqli_connect 127.0.0.1 ***/
$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
/*** test mysqli_connect 127.0.0.1 ***/
$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
if (!mysqli_query($link, "DROP TABLE IF EXISTS test_bind_result"))
printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
if (!mysqli_query($link, "DROP TABLE IF EXISTS test_bind_result"))
printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
$rc = mysqli_query($link, "CREATE TABLE test_bind_result(c1 tinyint, c2 smallint,
c3 int, c4 bigint,
c5 float, c6 double,
c7 varbinary(10),
c8 varchar(50)) ENGINE=" . $engine);
if (!$rc)
printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
$rc = mysqli_query($link, "CREATE TABLE test_bind_result(c1 tinyint, c2 smallint,
c3 int, c4 bigint,
c5 float, c6 double,
c7 varbinary(10),
c8 varchar(50)) ENGINE=" . $engine);
if (!$rc)
printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
$rc = mysqli_query($link,"INSERT INTO test_bind_result VALUES(19,2999,3999,4999999,
2345.6,5678.89563,
'foobar','mysql rulez')");
if (!$rc)
printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
$rc = mysqli_query($link,"INSERT INTO test_bind_result VALUES(19,2999,3999,4999999,
2345.6,5678.89563,
'foobar','mysql rulez')");
if (!$rc)
printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
$stmt = mysqli_prepare($link, "SELECT * FROM test_bind_result");
mysqli_stmt_bind_result($stmt, $c1, $c2, $c3, $c4, $c5, $c6, $c7, $c8);
mysqli_stmt_execute($stmt);
mysqli_stmt_fetch($stmt);
$stmt = mysqli_prepare($link, "SELECT * FROM test_bind_result");
mysqli_stmt_bind_result($stmt, $c1, $c2, $c3, $c4, $c5, $c6, $c7, $c8);
mysqli_stmt_execute($stmt);
mysqli_stmt_fetch($stmt);
$test = array($c1,$c2,$c3,$c4,$c5,$c6,$c7,$c8);
$test = array($c1,$c2,$c3,$c4,$c5,$c6,$c7,$c8);
var_dump($test);
var_dump($test);
mysqli_stmt_close($stmt);
mysqli_query($link, "DROP TABLE IF EXISTS test_bind_result");
mysqli_close($link);
print "done!";
mysqli_stmt_close($stmt);
mysqli_query($link, "DROP TABLE IF EXISTS test_bind_result");
mysqli_close($link);
print "done!";
?>
--CLEAN--
<?php
@@ -52,7 +52,7 @@ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
printf("[c001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
if (!mysqli_query($link, "DROP TABLE IF EXISTS test_bind_result"))
printf("[c002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
printf("[c002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
mysqli_close($link);
?>
+27 -27
View File
@@ -9,40 +9,40 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
require_once("connect.inc");
require_once("connect.inc");
/*** test mysqli_connect 127.0.0.1 ***/
$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
/*** test mysqli_connect 127.0.0.1 ***/
$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
if (!mysqli_query($link, "DROP TABLE IF EXISTS test_bind_result"))
printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
if (!mysqli_query($link, "DROP TABLE IF EXISTS test_bind_result"))
printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
$rc = mysqli_query($link, "CREATE TABLE test_bind_result(c1 tinyint, c2 smallint,
c3 int, c4 bigint,
c5 float, c6 double,
c7 varbinary(10),
c8 varchar(10)) ENGINE=" . $engine);
if (!$rc)
printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
$rc = mysqli_query($link, "CREATE TABLE test_bind_result(c1 tinyint, c2 smallint,
c3 int, c4 bigint,
c5 float, c6 double,
c7 varbinary(10),
c8 varchar(10)) ENGINE=" . $engine);
if (!$rc)
printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
if (!mysqli_query($link, "INSERT INTO test_bind_result VALUES(120,2999,3999,54,
2.6,58.89,
'206','6.7')"))
printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
if (!mysqli_query($link, "INSERT INTO test_bind_result VALUES(120,2999,3999,54,
2.6,58.89,
'206','6.7')"))
printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
$stmt = mysqli_prepare($link, "SELECT * FROM test_bind_result");
mysqli_stmt_bind_result($stmt, $c1, $c2, $c3, $c4, $c5, $c6, $c7, $c8);
mysqli_stmt_execute($stmt);
mysqli_stmt_fetch($stmt);
$stmt = mysqli_prepare($link, "SELECT * FROM test_bind_result");
mysqli_stmt_bind_result($stmt, $c1, $c2, $c3, $c4, $c5, $c6, $c7, $c8);
mysqli_stmt_execute($stmt);
mysqli_stmt_fetch($stmt);
$test = array($c1,$c2,$c3,$c4,$c5,$c6,$c7,$c8);
$test = array($c1,$c2,$c3,$c4,$c5,$c6,$c7,$c8);
var_dump($test);
var_dump($test);
mysqli_stmt_close($stmt);
mysqli_query($link, "DROP TABLE IF EXISTS test_bind_result");
mysqli_close($link);
print "done!";
mysqli_stmt_close($stmt);
mysqli_query($link, "DROP TABLE IF EXISTS test_bind_result");
mysqli_close($link);
print "done!";
?>
--CLEAN--
<?php
@@ -51,7 +51,7 @@ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
printf("[c001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
if (!mysqli_query($link, "DROP TABLE IF EXISTS test_bind_result"))
printf("[c002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
printf("[c002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
mysqli_close($link);
?>
+40 -40
View File
@@ -7,54 +7,54 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
require_once("connect.inc");
require_once("connect.inc");
/*** test mysqli_connect 127.0.0.1 ***/
$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
/*** test mysqli_connect 127.0.0.1 ***/
$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
if (!mysqli_query($link, "DROP TABLE IF EXISTS test_bind_result"))
printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
if (!mysqli_query($link, "DROP TABLE IF EXISTS test_bind_result"))
printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
$rc = mysqli_query($link, "CREATE TABLE test_bind_result(c1 tinyint, c2 smallint,
c3 int, c4 bigint,
c5 decimal(4,2), c6 double,
c7 varbinary(10),
c8 varchar(10)) ENGINE=" . $engine);
if (!$rc)
printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
$rc = mysqli_query($link, "CREATE TABLE test_bind_result(c1 tinyint, c2 smallint,
c3 int, c4 bigint,
c5 decimal(4,2), c6 double,
c7 varbinary(10),
c8 varchar(10)) ENGINE=" . $engine);
if (!$rc)
printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
if (!mysqli_query($link, "INSERT INTO test_bind_result VALUES(120,2999,3999,54,
2.6,58.89,
'206','6.7')"))
printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
if (!mysqli_query($link, "INSERT INTO test_bind_result VALUES(120,2999,3999,54,
2.6,58.89,
'206','6.7')"))
printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
$stmt = mysqli_prepare($link, "SELECT * FROM test_bind_result");
$stmt = mysqli_prepare($link, "SELECT * FROM test_bind_result");
$c = array(0,0,0,0,0,0,0,0);
$b_res= mysqli_stmt_bind_result($stmt, $c[0], $c[1], $c[2], $c[3], $c[4], $c[5], $c[6], $c[7]);
mysqli_stmt_execute($stmt);
mysqli_stmt_fetch($stmt);
mysqli_stmt_fetch($stmt);
mysqli_stmt_close($stmt);
$c = array(0,0,0,0,0,0,0,0);
$b_res= mysqli_stmt_bind_result($stmt, $c[0], $c[1], $c[2], $c[3], $c[4], $c[5], $c[6], $c[7]);
mysqli_stmt_execute($stmt);
mysqli_stmt_fetch($stmt);
mysqli_stmt_fetch($stmt);
mysqli_stmt_close($stmt);
$result = mysqli_query($link, "select * from test_bind_result");
$d = mysqli_fetch_row($result);
mysqli_free_result($result);
$result = mysqli_query($link, "select * from test_bind_result");
$d = mysqli_fetch_row($result);
mysqli_free_result($result);
$test = "";
for ($i=0; $i < count($c); $i++)
$test .= ($c[$i] == $d[$i]) ? "1" : "0";
if ($test == "11111111")
echo "ok\n";
else if ($b_res == FALSE && mysqli_get_client_version() > 40100 && mysqli_get_client_version() < 50000 &&
mysqli_get_server_version($link) > 50000)
echo "error (4.1 library with 5.x server)";
else
echo "error";
$test = "";
for ($i=0; $i < count($c); $i++)
$test .= ($c[$i] == $d[$i]) ? "1" : "0";
if ($test == "11111111")
echo "ok\n";
else if ($b_res == FALSE && mysqli_get_client_version() > 40100 && mysqli_get_client_version() < 50000 &&
mysqli_get_server_version($link) > 50000)
echo "error (4.1 library with 5.x server)";
else
echo "error";
mysqli_query($link, "DROP TABLE IF EXISTS test_bind_result");
mysqli_close($link);
print "done!";
mysqli_query($link, "DROP TABLE IF EXISTS test_bind_result");
mysqli_close($link);
print "done!";
?>
--CLEAN--
<?php
@@ -63,7 +63,7 @@ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
printf("[c001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
if (!mysqli_query($link, "DROP TABLE IF EXISTS test_bind_result"))
printf("[c002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
printf("[c002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
mysqli_close($link);
?>
+49 -49
View File
@@ -2,83 +2,83 @@
mysqli autocommit/commit/rollback
--SKIPIF--
<?php
require_once('skipif.inc');
require_once('skipifconnectfailure.inc');
require_once("connect.inc");
require_once('skipif.inc');
require_once('skipifconnectfailure.inc');
require_once("connect.inc");
$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
if (!$link)
die(sprintf("skip Cannot connect, [%d] %s", mysqli_connect_errno(), mysqli_connect_error()));
$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
if (!$link)
die(sprintf("skip Cannot connect, [%d] %s", mysqli_connect_errno(), mysqli_connect_error()));
if (!have_innodb($link))
die(sprintf("skip Needs InnoDB support, [%d] %s", $link->errno, $link->error));
if (!have_innodb($link))
die(sprintf("skip Needs InnoDB support, [%d] %s", $link->errno, $link->error));
?>
--FILE--
<?php
require_once("connect.inc");
$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
require_once("connect.inc");
$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
if (!mysqli_autocommit($link, TRUE))
printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
if (!mysqli_autocommit($link, TRUE))
printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
if (!mysqli_query($link, "DROP TABLE IF EXISTS test"))
printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
if (!mysqli_query($link, "DROP TABLE IF EXISTS test"))
printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
if (!mysqli_query($link, "CREATE TABLE test(a int, b varchar(10)) engine=InnoDB"))
printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
if (!mysqli_query($link, "CREATE TABLE test(a int, b varchar(10)) engine=InnoDB"))
printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
if (!mysqli_query($link, "INSERT INTO test VALUES (1, 'foobar')"))
printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
if (!mysqli_query($link, "INSERT INTO test VALUES (1, 'foobar')"))
printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
if (!mysqli_autocommit($link, FALSE))
printf("[005] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
if (!mysqli_autocommit($link, FALSE))
printf("[005] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
if (!mysqli_query($link, "DELETE FROM test"))
printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
if (!mysqli_query($link, "DELETE FROM test"))
printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
if (!mysqli_query($link, "INSERT INTO test VALUES (2, 'egon')"))
printf("[007] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
if (!mysqli_query($link, "INSERT INTO test VALUES (2, 'egon')"))
printf("[007] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
if (!mysqli_rollback($link))
printf("[008] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
if (!mysqli_rollback($link))
printf("[008] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
if (!$result = mysqli_query($link, "SELECT * FROM test"))
printf("[009] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
if (!$result = mysqli_query($link, "SELECT * FROM test"))
printf("[009] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
printf("Num_of_rows=%d\n", mysqli_num_rows($result));
if (!$row = mysqli_fetch_row($result))
printf("[010] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
printf("Num_of_rows=%d\n", mysqli_num_rows($result));
if (!$row = mysqli_fetch_row($result))
printf("[010] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
mysqli_free_result($result);
mysqli_free_result($result);
var_dump($row);
var_dump($row);
if (!mysqli_query($link, "DELETE FROM test"))
printf("[011] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
if (!mysqli_query($link, "DELETE FROM test"))
printf("[011] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
if (!mysqli_query($link, "INSERT INTO test VALUES (2, 'egon')"))
printf("[012] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
if (!mysqli_query($link, "INSERT INTO test VALUES (2, 'egon')"))
printf("[012] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
if (!mysqli_commit($link))
printf("[012] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
if (!mysqli_commit($link))
printf("[012] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
if (!$result = mysqli_query($link, "SELECT * FROM test"))
printf("[013] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
if (!$result = mysqli_query($link, "SELECT * FROM test"))
printf("[013] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
if (!$row = mysqli_fetch_row($result))
printf("[014] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
if (!$row = mysqli_fetch_row($result))
printf("[014] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
mysqli_free_result($result);
mysqli_free_result($result);
var_dump($row);
var_dump($row);
mysqli_query($link, "DROP TABLE IF EXISTS test");
mysqli_close($link);
print "done!";
mysqli_query($link, "DROP TABLE IF EXISTS test");
mysqli_close($link);
print "done!";
?>
--CLEAN--
<?php
require_once("clean_table.inc");
require_once("clean_table.inc");
?>
--EXPECT--
Num_of_rows=1
+53 -53
View File
@@ -2,81 +2,81 @@
mysqli autocommit/commit/rollback with innodb
--SKIPIF--
<?php
require_once('skipif.inc');
require_once('skipifconnectfailure.inc');
require_once('skipif.inc');
require_once('skipifconnectfailure.inc');
require_once('connect.inc');
if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
die(sprintf("skip Cannot connect, [%d] %s", mysqli_connect_errno(), mysqli_connect_error()));
require_once('connect.inc');
if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
die(sprintf("skip Cannot connect, [%d] %s", mysqli_connect_errno(), mysqli_connect_error()));
if (!have_innodb($link))
die(sprintf("skip Needs InnoDB support, [%d] %s", $link->errno, $link->error));
if (!have_innodb($link))
die(sprintf("skip Needs InnoDB support, [%d] %s", $link->errno, $link->error));
?>
--FILE--
<?php
require_once("connect.inc");
require_once("connect.inc");
$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
if (!$link)
printf("[001] Cannot connect, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
if (!$link)
printf("[001] Cannot connect, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
if (!mysqli_select_db($link, $db))
printf("[002] Cannot select DB '%s', [%d] %s\n", $db,
mysqli_errno($link), mysqli_error($link));
if (!mysqli_select_db($link, $db))
printf("[002] Cannot select DB '%s', [%d] %s\n", $db,
mysqli_errno($link), mysqli_error($link));
if (!mysqli_autocommit($link, TRUE))
printf("[003] Cannot turn on autocommit mode, [%d] %s\n",
mysqli_errno($link), mysqli_error($link));
if (!mysqli_autocommit($link, TRUE))
printf("[003] Cannot turn on autocommit mode, [%d] %s\n",
mysqli_errno($link), mysqli_error($link));
if (!mysqli_query($link,"DROP TABLE IF EXISTS test") ||
!mysqli_query($link,"CREATE TABLE test(a int, b varchar(10)) Engine=InnoDB") ||
!mysqli_query($link, "INSERT INTO test VALUES (1, 'foobar')"))
printf("[004] Cannot create test data, [%d] %s\n",
mysqli_errno($link), mysqli_error($link));
if (!mysqli_query($link,"DROP TABLE IF EXISTS test") ||
!mysqli_query($link,"CREATE TABLE test(a int, b varchar(10)) Engine=InnoDB") ||
!mysqli_query($link, "INSERT INTO test VALUES (1, 'foobar')"))
printf("[004] Cannot create test data, [%d] %s\n",
mysqli_errno($link), mysqli_error($link));
if (!mysqli_autocommit($link, FALSE))
printf("[005] Cannot turn off autocommit mode, [%d] %s\n",
mysqli_errno($link), mysqli_error($link));
if (!mysqli_autocommit($link, FALSE))
printf("[005] Cannot turn off autocommit mode, [%d] %s\n",
mysqli_errno($link), mysqli_error($link));
if (!mysqli_query($link, "DELETE FROM test") ||
!mysqli_query($link, "INSERT INTO test VALUES (2, 'egon')"))
printf("[006] Cannot modify test data, [%d] %s\n",
mysqli_errno($link), mysqli_error($link));
if (!mysqli_query($link, "DELETE FROM test") ||
!mysqli_query($link, "INSERT INTO test VALUES (2, 'egon')"))
printf("[006] Cannot modify test data, [%d] %s\n",
mysqli_errno($link), mysqli_error($link));
if (!mysqli_rollback($link))
printf("[007] Cannot call rollback, [%d] %s\n",
mysqli_errno($link), mysqli_error($link));
if (!mysqli_rollback($link))
printf("[007] Cannot call rollback, [%d] %s\n",
mysqli_errno($link), mysqli_error($link));
$result = mysqli_query($link, "SELECT SQL_NO_CACHE * FROM test");
if (!$result)
printf("[008] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
$row = mysqli_fetch_row($result);
mysqli_free_result($result);
$result = mysqli_query($link, "SELECT SQL_NO_CACHE * FROM test");
if (!$result)
printf("[008] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
$row = mysqli_fetch_row($result);
mysqli_free_result($result);
var_dump($row);
var_dump($row);
if (!mysqli_query($link, "DELETE FROM test") ||
!mysqli_query($link, "INSERT INTO test VALUES (2, 'egon')"))
printf("[009] Cannot modify test data, [%d] %s\n",
mysqli_errno($link), mysqli_error($link));
if (!mysqli_query($link, "DELETE FROM test") ||
!mysqli_query($link, "INSERT INTO test VALUES (2, 'egon')"))
printf("[009] Cannot modify test data, [%d] %s\n",
mysqli_errno($link), mysqli_error($link));
mysqli_commit($link);
mysqli_commit($link);
$result = mysqli_query($link, "SELECT * FROM test");
if (!$result)
printf("[010] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
$row = mysqli_fetch_row($result);
mysqli_free_result($result);
$result = mysqli_query($link, "SELECT * FROM test");
if (!$result)
printf("[010] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
$row = mysqli_fetch_row($result);
mysqli_free_result($result);
var_dump($row);
var_dump($row);
mysqli_query($link, "DROP TABLE IF EXISTS test");
mysqli_close($link);
print "done!";
mysqli_query($link, "DROP TABLE IF EXISTS test");
mysqli_close($link);
print "done!";
?>
--CLEAN--
<?php
require_once("clean_table.inc");
require_once("clean_table.inc");
?>
--EXPECT--
array(2) {
+14 -14
View File
@@ -7,26 +7,26 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
require_once("connect.inc");
require_once("connect.inc");
/*** test mysqli_connect 127.0.0.1 ***/
$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
/*** test mysqli_connect 127.0.0.1 ***/
$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
if (!mysqli_query($link, "SET @dummy='foobar'"))
printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
if (!mysqli_query($link, "SET @dummy='foobar'"))
printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
if (!$stmt = mysqli_prepare($link, "SELECT @dummy"))
printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
if (!$stmt = mysqli_prepare($link, "SELECT @dummy"))
printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
mysqli_stmt_bind_result($stmt, $dummy);
mysqli_stmt_execute($stmt);
mysqli_stmt_fetch($stmt);
mysqli_stmt_bind_result($stmt, $dummy);
mysqli_stmt_execute($stmt);
mysqli_stmt_fetch($stmt);
var_dump($dummy);
var_dump($dummy);
mysqli_stmt_close($stmt);
mysqli_close($link);
print "done!";
mysqli_stmt_close($stmt);
mysqli_close($link);
print "done!";
?>
--EXPECT--
string(6) "foobar"
+16 -16
View File
@@ -8,28 +8,28 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
require_once("connect.inc");
require_once("connect.inc");
/*** test mysqli_connect 127.0.0.1 ***/
$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
/*** test mysqli_connect 127.0.0.1 ***/
$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
if (!$stmt = mysqli_prepare($link, "SELECT md5('bar'), database(), 'foo'"))
printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
if (!$stmt = mysqli_prepare($link, "SELECT md5('bar'), database(), 'foo'"))
printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
mysqli_stmt_bind_result($stmt, $c0, $c1, $c2);
mysqli_stmt_execute($stmt);
mysqli_stmt_bind_result($stmt, $c0, $c1, $c2);
mysqli_stmt_execute($stmt);
mysqli_stmt_fetch($stmt);
mysqli_stmt_close($stmt);
mysqli_stmt_fetch($stmt);
mysqli_stmt_close($stmt);
$test = array($c0, $c1, $c2);
if ($c1 !== $db) {
echo "Different data\n";
}
$test = array($c0, $c1, $c2);
if ($c1 !== $db) {
echo "Different data\n";
}
var_dump($test);
mysqli_close($link);
print "done!";
var_dump($test);
mysqli_close($link);
print "done!";
?>
--EXPECTF--
array(3) {
+13 -13
View File
@@ -7,26 +7,26 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
require_once("connect.inc");
require_once("connect.inc");
/*** test mysqli_connect 127.0.0.1 ***/
$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
/*** test mysqli_connect 127.0.0.1 ***/
$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
if (!mysqli_query($link, "SET AUTOCOMMIT=0"))
printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
if (!mysqli_query($link, "SET AUTOCOMMIT=0"))
printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
if (!$stmt = mysqli_prepare($link, "SELECT @@autocommit"))
printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
if (!$stmt = mysqli_prepare($link, "SELECT @@autocommit"))
printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
mysqli_stmt_bind_result($stmt, $c0);
mysqli_stmt_execute($stmt);
mysqli_stmt_bind_result($stmt, $c0);
mysqli_stmt_execute($stmt);
mysqli_stmt_fetch($stmt);
mysqli_stmt_fetch($stmt);
var_dump($c0);
var_dump($c0);
mysqli_close($link);
print "done!";
mysqli_close($link);
print "done!";
?>
--EXPECT--
int(0)
+35 -35
View File
@@ -7,53 +7,53 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
require_once("connect.inc");
require_once("connect.inc");
/*** test mysqli_connect 127.0.0.1 ***/
$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
/*** test mysqli_connect 127.0.0.1 ***/
$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
if (!mysqli_query($link, "DROP TABLE IF EXISTS insert_read"))
printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
if (!mysqli_query($link, "DROP TABLE IF EXISTS insert_read"))
printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
$rc = mysqli_query($link,"CREATE TABLE insert_read(col1 tinyint, col2 smallint,
col3 int, col4 bigint,
col5 float, col6 double,
col7 date, col8 time,
col9 varbinary(10),
col10 varchar(50),
col11 char(20)) ENGINE=" . $engine);
if (!$rc)
printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
$rc = mysqli_query($link,"CREATE TABLE insert_read(col1 tinyint, col2 smallint,
col3 int, col4 bigint,
col5 float, col6 double,
col7 date, col8 time,
col9 varbinary(10),
col10 varchar(50),
col11 char(20)) ENGINE=" . $engine);
if (!$rc)
printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
if (!$stmt = mysqli_prepare($link, "INSERT INTO insert_read(col1,col10, col11, col6) VALUES (?,?,?,?)"))
printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
if (!$stmt = mysqli_prepare($link, "INSERT INTO insert_read(col1,col10, col11, col6) VALUES (?,?,?,?)"))
printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
mysqli_stmt_bind_param($stmt, "issd", $c1, $c2, $c3, $c4);
mysqli_stmt_bind_param($stmt, "issd", $c1, $c2, $c3, $c4);
$c1 = 1;
$c2 = "foo";
$c3 = "foobar";
$c4 = 3.14;
$c1 = 1;
$c2 = "foo";
$c3 = "foobar";
$c4 = 3.14;
mysqli_stmt_execute($stmt);
mysqli_stmt_close($stmt);
mysqli_stmt_execute($stmt);
mysqli_stmt_close($stmt);
if (!$stmt = mysqli_prepare($link, "SELECT col1, col2, col3, col4, col5, col6, col7, col8, col9, col10, col11 FROM insert_read"))
printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
if (!$stmt = mysqli_prepare($link, "SELECT col1, col2, col3, col4, col5, col6, col7, col8, col9, col10, col11 FROM insert_read"))
printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
mysqli_stmt_bind_result($stmt, $c1, $c2, $c3, $c4, $c5, $c6, $c7, $c8, $c9, $c10, $c11);
mysqli_stmt_execute($stmt);
mysqli_stmt_bind_result($stmt, $c1, $c2, $c3, $c4, $c5, $c6, $c7, $c8, $c9, $c10, $c11);
mysqli_stmt_execute($stmt);
mysqli_stmt_fetch($stmt);
mysqli_stmt_fetch($stmt);
$test = array($c1,$c2,$c3,$c4,$c5,$c6,$c7,$c8,$c9,$c10,$c11);
$test = array($c1,$c2,$c3,$c4,$c5,$c6,$c7,$c8,$c9,$c10,$c11);
var_dump($test);
var_dump($test);
mysqli_stmt_close($stmt);
mysqli_query($link, "DROP TABLE IF EXISTS insert_read");
mysqli_close($link);
print "done!";
mysqli_stmt_close($stmt);
mysqli_query($link, "DROP TABLE IF EXISTS insert_read");
mysqli_close($link);
print "done!";
?>
--CLEAN--
<?php
@@ -62,7 +62,7 @@ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
printf("[c001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
if (!mysqli_query($link, "DROP TABLE IF EXISTS insert_read"))
printf("[c002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
printf("[c002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
mysqli_close($link);
?>
+45 -45
View File
@@ -7,65 +7,65 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
require_once("connect.inc");
require_once("connect.inc");
/*** test mysqli_connect 127.0.0.1 ***/
$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
/*** test mysqli_connect 127.0.0.1 ***/
$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
mysqli_select_db($link, $db);
mysqli_query($link, "SET sql_mode=''");
mysqli_select_db($link, $db);
mysqli_query($link, "SET sql_mode=''");
mysqli_query($link,"DROP TABLE IF EXISTS test_bind_result");
mysqli_query($link,"DROP TABLE IF EXISTS test_bind_result");
$rc = @mysqli_query($link,"CREATE TABLE test_bind_result(
c1 date,
c2 time,
c3 timestamp(14),
c4 year,
c5 datetime,
c6 timestamp(4),
c7 timestamp(6))");
$rc = @mysqli_query($link,"CREATE TABLE test_bind_result(
c1 date,
c2 time,
c3 timestamp(14),
c4 year,
c5 datetime,
c6 timestamp(4),
c7 timestamp(6))");
if (!$rc)
$rc = mysqli_query($link,"CREATE TABLE test_bind_result(
c1 date,
c2 time,
c3 timestamp,
c4 year,
c5 datetime,
c6 timestamp,
c7 timestamp)");
if (!$rc)
$rc = mysqli_query($link,"CREATE TABLE test_bind_result(
c1 date,
c2 time,
c3 timestamp,
c4 year,
c5 datetime,
c6 timestamp,
c7 timestamp)");
$stmt = mysqli_prepare($link, "INSERT INTO test_bind_result VALUES (?,?,?,?,?,?,?)");
mysqli_stmt_bind_param($stmt, "sssssss", $d1, $d2, $d3, $d4, $d5, $d6, $d7);
$stmt = mysqli_prepare($link, "INSERT INTO test_bind_result VALUES (?,?,?,?,?,?,?)");
mysqli_stmt_bind_param($stmt, "sssssss", $d1, $d2, $d3, $d4, $d5, $d6, $d7);
$d1 = "2002-01-02";
$d2 = "12:49:00";
$d3 = "2002-01-02 17:46:59";
$d4 = "2010";
$d5 = "2010-07-10";
$d6 = "2020";
$d7 = "1999-12-29";
$d1 = "2002-01-02";
$d2 = "12:49:00";
$d3 = "2002-01-02 17:46:59";
$d4 = "2010";
$d5 = "2010-07-10";
$d6 = "2020";
$d7 = "1999-12-29";
mysqli_stmt_execute($stmt);
mysqli_stmt_close($stmt);
mysqli_stmt_execute($stmt);
mysqli_stmt_close($stmt);
$stmt = mysqli_prepare($link, "SELECT c1, c2, c3, c4, c5, c6, c7 FROM test_bind_result");
$stmt = mysqli_prepare($link, "SELECT c1, c2, c3, c4, c5, c6, c7 FROM test_bind_result");
mysqli_stmt_bind_result($stmt,$c1, $c2, $c3, $c4, $c5, $c6, $c7);
mysqli_stmt_bind_result($stmt,$c1, $c2, $c3, $c4, $c5, $c6, $c7);
mysqli_stmt_execute($stmt);
mysqli_stmt_fetch($stmt);
mysqli_stmt_execute($stmt);
mysqli_stmt_fetch($stmt);
$test = array($c1,$c2,$c3,$c4,$c5,$c6,$c7);
$test = array($c1,$c2,$c3,$c4,$c5,$c6,$c7);
var_dump($test);
var_dump($test);
mysqli_stmt_close($stmt);
mysqli_query($link, "DROP TABLE IF EXISTS test_bind_result");
mysqli_close($link);
mysqli_stmt_close($stmt);
mysqli_query($link, "DROP TABLE IF EXISTS test_bind_result");
mysqli_close($link);
print "done!";
print "done!";
?>
--CLEAN--
<?php
@@ -74,7 +74,7 @@ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
printf("[c001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
if (!mysqli_query($link, "DROP TABLE IF EXISTS test_bind_result"))
printf("[c002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
printf("[c002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
mysqli_close($link);
?>
+23 -23
View File
@@ -7,36 +7,36 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
require_once("connect.inc");
require_once("connect.inc");
/*** test mysqli_connect 127.0.0.1 ***/
$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
/*** test mysqli_connect 127.0.0.1 ***/
$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
mysqli_select_db($link, $db);
mysqli_select_db($link, $db);
mysqli_query($link,"DROP TABLE IF EXISTS test_bind_fetch");
mysqli_query($link,"CREATE TABLE test_bind_fetch(c1 char(10), c2 text)");
mysqli_query($link,"DROP TABLE IF EXISTS test_bind_fetch");
mysqli_query($link,"CREATE TABLE test_bind_fetch(c1 char(10), c2 text)");
$stmt = mysqli_prepare($link, "INSERT INTO test_bind_fetch VALUES (?,?)");
mysqli_stmt_bind_param($stmt, "ss", $q1, $q2);
$q1 = "1234567890";
$q2 = "this is a test";
mysqli_stmt_execute($stmt);
mysqli_stmt_close($stmt);
$stmt = mysqli_prepare($link, "INSERT INTO test_bind_fetch VALUES (?,?)");
mysqli_stmt_bind_param($stmt, "ss", $q1, $q2);
$q1 = "1234567890";
$q2 = "this is a test";
mysqli_stmt_execute($stmt);
mysqli_stmt_close($stmt);
$stmt = mysqli_prepare($link, "SELECT * FROM test_bind_fetch");
mysqli_stmt_bind_result($stmt, $c1, $c2);
mysqli_stmt_execute($stmt);
mysqli_stmt_fetch($stmt);
$stmt = mysqli_prepare($link, "SELECT * FROM test_bind_fetch");
mysqli_stmt_bind_result($stmt, $c1, $c2);
mysqli_stmt_execute($stmt);
mysqli_stmt_fetch($stmt);
$test = array($c1,$c2);
$test = array($c1,$c2);
var_dump($test);
var_dump($test);
mysqli_stmt_close($stmt);
mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch");
mysqli_close($link);
print "done!";
mysqli_stmt_close($stmt);
mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch");
mysqli_close($link);
print "done!";
?>
--CLEAN--
<?php
@@ -45,7 +45,7 @@ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
printf("[c001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
if (!mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch"))
printf("[c002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
printf("[c002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
mysqli_close($link);
?>
+24 -24
View File
@@ -7,41 +7,41 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
require_once("connect.inc");
require_once("connect.inc");
/*** test mysqli_connect 127.0.0.1 ***/
$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
/*** test mysqli_connect 127.0.0.1 ***/
$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
mysqli_select_db($link, $db);
mysqli_select_db($link, $db);
mysqli_query($link,"DROP TABLE IF EXISTS test_bind_fetch");
mysqli_query($link,"CREATE TABLE test_bind_fetch(c1 char(10), c2 text)");
mysqli_query($link,"DROP TABLE IF EXISTS test_bind_fetch");
mysqli_query($link,"CREATE TABLE test_bind_fetch(c1 char(10), c2 text)");
$stmt = mysqli_prepare($link, "INSERT INTO test_bind_fetch VALUES (?,?)");
mysqli_stmt_bind_param($stmt, "ss", $a1, $a2);
$stmt = mysqli_prepare($link, "INSERT INTO test_bind_fetch VALUES (?,?)");
mysqli_stmt_bind_param($stmt, "ss", $a1, $a2);
$a1 = "1234567890";
$a2 = str_repeat("A1", 32000);
$a1 = "1234567890";
$a2 = str_repeat("A1", 32000);
mysqli_stmt_execute($stmt);
mysqli_stmt_close($stmt);
mysqli_stmt_execute($stmt);
mysqli_stmt_close($stmt);
$stmt = mysqli_prepare($link, "SELECT * FROM test_bind_fetch");
mysqli_stmt_bind_result($stmt, $c1, $c2);
mysqli_stmt_execute($stmt);
mysqli_stmt_fetch($stmt);
$stmt = mysqli_prepare($link, "SELECT * FROM test_bind_fetch");
mysqli_stmt_bind_result($stmt, $c1, $c2);
mysqli_stmt_execute($stmt);
mysqli_stmt_fetch($stmt);
$test[] = $c1;
$test[] = ($a2 == $c2) ? "32K String ok" : "32K String failed";
$test[] = $c1;
$test[] = ($a2 == $c2) ? "32K String ok" : "32K String failed";
var_dump($test);
var_dump($test);
mysqli_stmt_close($stmt);
mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch");
mysqli_close($link);
mysqli_stmt_close($stmt);
mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch");
mysqli_close($link);
print "done!";
print "done!";
?>
--CLEAN--
<?php
@@ -50,7 +50,7 @@ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
printf("[c001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
if (!mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch"))
printf("[c002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
printf("[c002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
mysqli_close($link);
?>
+35 -35
View File
@@ -7,50 +7,50 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
require_once("connect.inc");
require_once("connect.inc");
/*** test mysqli_connect 127.0.0.1 ***/
$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
/*** test mysqli_connect 127.0.0.1 ***/
$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
mysqli_select_db($link, $db);
mysqli_query($link, "SET sql_mode=''");
mysqli_select_db($link, $db);
mysqli_query($link, "SET sql_mode=''");
mysqli_query($link,"DROP TABLE IF EXISTS test_bind_fetch");
mysqli_query($link,"CREATE TABLE test_bind_fetch(c1 int unsigned,
c2 int unsigned,
c3 int,
c4 int,
c5 int,
c6 int unsigned,
c7 int)");
mysqli_query($link,"DROP TABLE IF EXISTS test_bind_fetch");
mysqli_query($link,"CREATE TABLE test_bind_fetch(c1 int unsigned,
c2 int unsigned,
c3 int,
c4 int,
c5 int,
c6 int unsigned,
c7 int)");
$stmt = mysqli_prepare($link, "INSERT INTO test_bind_fetch VALUES (?,?,?,?,?,?,?)");
mysqli_stmt_bind_param($stmt, "iiiiiii", $c1,$c2,$c3,$c4,$c5,$c6,$c7);
$c1 = -23;
$c2 = 35999;
$c3 = NULL;
$c4 = -500;
$c5 = -9999999;
$c6 = -0;
$c7 = 0;
$stmt = mysqli_prepare($link, "INSERT INTO test_bind_fetch VALUES (?,?,?,?,?,?,?)");
mysqli_stmt_bind_param($stmt, "iiiiiii", $c1,$c2,$c3,$c4,$c5,$c6,$c7);
$c1 = -23;
$c2 = 35999;
$c3 = NULL;
$c4 = -500;
$c5 = -9999999;
$c6 = -0;
$c7 = 0;
mysqli_stmt_execute($stmt);
mysqli_stmt_close($stmt);
mysqli_stmt_execute($stmt);
mysqli_stmt_close($stmt);
$stmt = mysqli_prepare($link, "SELECT * FROM test_bind_fetch");
mysqli_stmt_bind_result($stmt, $c1, $c2, $c3, $c4, $c5, $c6, $c7);
mysqli_stmt_execute($stmt);
mysqli_stmt_fetch($stmt);
$stmt = mysqli_prepare($link, "SELECT * FROM test_bind_fetch");
mysqli_stmt_bind_result($stmt, $c1, $c2, $c3, $c4, $c5, $c6, $c7);
mysqli_stmt_execute($stmt);
mysqli_stmt_fetch($stmt);
$test = array($c1,$c2,$c3,$c4,$c5,$c6,$c7);
$test = array($c1,$c2,$c3,$c4,$c5,$c6,$c7);
var_dump($test);
var_dump($test);
mysqli_stmt_close($stmt);
mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch");
mysqli_close($link);
mysqli_stmt_close($stmt);
mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch");
mysqli_close($link);
print "done!";
print "done!";
?>
--CLEAN--
<?php
@@ -59,7 +59,7 @@ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
printf("[c001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
if (!mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch"))
printf("[c002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
printf("[c002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
mysqli_close($link);
?>
+35 -35
View File
@@ -7,50 +7,50 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
require_once("connect.inc");
require_once("connect.inc");
/*** test mysqli_connect 127.0.0.1 ***/
$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
/*** test mysqli_connect 127.0.0.1 ***/
$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
mysqli_select_db($link, $db);
mysqli_query($link, "SET sql_mode=''");
mysqli_select_db($link, $db);
mysqli_query($link, "SET sql_mode=''");
mysqli_query($link,"DROP TABLE IF EXISTS test_bind_fetch");
mysqli_query($link,"CREATE TABLE test_bind_fetch(c1 smallint unsigned,
c2 smallint unsigned,
c3 smallint,
c4 smallint,
c5 smallint,
c6 smallint unsigned,
c7 smallint)");
mysqli_query($link,"DROP TABLE IF EXISTS test_bind_fetch");
mysqli_query($link,"CREATE TABLE test_bind_fetch(c1 smallint unsigned,
c2 smallint unsigned,
c3 smallint,
c4 smallint,
c5 smallint,
c6 smallint unsigned,
c7 smallint)");
$stmt = mysqli_prepare($link, "INSERT INTO test_bind_fetch VALUES (?,?,?,?,?,?,?)");
mysqli_stmt_bind_param($stmt, "iiiiiii", $c1,$c2,$c3,$c4,$c5,$c6,$c7);
$stmt = mysqli_prepare($link, "INSERT INTO test_bind_fetch VALUES (?,?,?,?,?,?,?)");
mysqli_stmt_bind_param($stmt, "iiiiiii", $c1,$c2,$c3,$c4,$c5,$c6,$c7);
$c1 = -23;
$c2 = 35999;
$c3 = NULL;
$c4 = -500;
$c5 = -9999999;
$c6 = -0;
$c7 = 0;
$c1 = -23;
$c2 = 35999;
$c3 = NULL;
$c4 = -500;
$c5 = -9999999;
$c6 = -0;
$c7 = 0;
mysqli_stmt_execute($stmt);
mysqli_stmt_close($stmt);
mysqli_stmt_execute($stmt);
mysqli_stmt_close($stmt);
$stmt = mysqli_prepare($link, "SELECT * FROM test_bind_fetch");
mysqli_stmt_bind_result($stmt, $c1, $c2, $c3, $c4, $c5, $c6, $c7);
mysqli_stmt_execute($stmt);
mysqli_stmt_fetch($stmt);
$stmt = mysqli_prepare($link, "SELECT * FROM test_bind_fetch");
mysqli_stmt_bind_result($stmt, $c1, $c2, $c3, $c4, $c5, $c6, $c7);
mysqli_stmt_execute($stmt);
mysqli_stmt_fetch($stmt);
$test = array($c1,$c2,$c3,$c4,$c5,$c6,$c7);
$test = array($c1,$c2,$c3,$c4,$c5,$c6,$c7);
var_dump($test);
var_dump($test);
mysqli_stmt_close($stmt);
mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch");
mysqli_close($link);
print "done!";
mysqli_stmt_close($stmt);
mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch");
mysqli_close($link);
print "done!";
?>
--CLEAN--
<?php
@@ -59,7 +59,7 @@ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
printf("[c001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
if (!mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch"))
printf("[c002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
printf("[c002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
mysqli_close($link);
?>
+37 -37
View File
@@ -7,55 +7,55 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
require_once("connect.inc");
require_once("connect.inc");
/*** test mysqli_connect 127.0.0.1 ***/
$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
/*** test mysqli_connect 127.0.0.1 ***/
$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
mysqli_select_db($link, $db);
mysqli_query($link, "SET sql_mode=''");
mysqli_select_db($link, $db);
mysqli_query($link, "SET sql_mode=''");
mysqli_query($link,"DROP TABLE IF EXISTS test_bind_fetch");
mysqli_query($link,"CREATE TABLE test_bind_fetch(c1 tinyint,
c2 tinyint unsigned,
c3 tinyint not NULL,
c4 tinyint,
c5 tinyint,
c6 tinyint unsigned,
c7 tinyint)");
mysqli_query($link,"DROP TABLE IF EXISTS test_bind_fetch");
mysqli_query($link,"CREATE TABLE test_bind_fetch(c1 tinyint,
c2 tinyint unsigned,
c3 tinyint not NULL,
c4 tinyint,
c5 tinyint,
c6 tinyint unsigned,
c7 tinyint)");
$stmt = mysqli_prepare ($link, "INSERT INTO test_bind_fetch VALUES(?,?,?,?,?,?,?)");
mysqli_stmt_bind_param($stmt, "iiiiiii", $c1,$c2,$c3,$c4,$c5,$c6,$c7);
$stmt = mysqli_prepare ($link, "INSERT INTO test_bind_fetch VALUES(?,?,?,?,?,?,?)");
mysqli_stmt_bind_param($stmt, "iiiiiii", $c1,$c2,$c3,$c4,$c5,$c6,$c7);
$c1 = -23;
$c2 = 300;
$c3 = 0;
$c4 = -100;
$c5 = -127;
$c6 = 30;
$c7 = 0;
$c1 = -23;
$c2 = 300;
$c3 = 0;
$c4 = -100;
$c5 = -127;
$c6 = 30;
$c7 = 0;
mysqli_stmt_execute($stmt);
mysqli_stmt_close($stmt);
mysqli_stmt_execute($stmt);
mysqli_stmt_close($stmt);
mysqli_query($link, "INSERT INTO test_bind_fetch VALUES (-23,300,0,-100,-127,+30,0)");
mysqli_query($link, "INSERT INTO test_bind_fetch VALUES (-23,300,0,-100,-127,+30,0)");
$c1 = $c2 = $c3 = $c4 = $c5 = $c6 = $c7 = NULL;
$c1 = $c2 = $c3 = $c4 = $c5 = $c6 = $c7 = NULL;
$stmt = mysqli_prepare($link, "SELECT * FROM test_bind_fetch");
mysqli_stmt_bind_result($stmt, $c1, $c2, $c3, $c4, $c5, $c6, $c7);
mysqli_stmt_execute($stmt);
mysqli_stmt_fetch($stmt);
$stmt = mysqli_prepare($link, "SELECT * FROM test_bind_fetch");
mysqli_stmt_bind_result($stmt, $c1, $c2, $c3, $c4, $c5, $c6, $c7);
mysqli_stmt_execute($stmt);
mysqli_stmt_fetch($stmt);
$test = array($c1,$c2,$c3,$c4,$c5,$c6,$c7);
$test = array($c1,$c2,$c3,$c4,$c5,$c6,$c7);
var_dump($test);
var_dump($test);
mysqli_stmt_close($stmt);
mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch");
mysqli_close($link);
mysqli_stmt_close($stmt);
mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch");
mysqli_close($link);
print "done!";
print "done!";
?>
--CLEAN--
<?php
@@ -64,7 +64,7 @@ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
printf("[c001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
if (!mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch"))
printf("[c002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
printf("[c002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
mysqli_close($link);
?>
+26 -26
View File
@@ -7,42 +7,42 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
require_once("connect.inc");
require_once("connect.inc");
/*** test mysqli_connect 127.0.0.1 ***/
$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
/*** test mysqli_connect 127.0.0.1 ***/
$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
mysqli_select_db($link, $db);
mysqli_query($link, "SET sql_mode=''");
mysqli_select_db($link, $db);
mysqli_query($link, "SET sql_mode=''");
mysqli_query($link,"DROP TABLE IF EXISTS test_bind_fetch");
mysqli_query($link,"CREATE TABLE test_bind_fetch(c1 varchar(10), c2 text)");
mysqli_query($link,"DROP TABLE IF EXISTS test_bind_fetch");
mysqli_query($link,"CREATE TABLE test_bind_fetch(c1 varchar(10), c2 text)");
$stmt = mysqli_prepare ($link, "INSERT INTO test_bind_fetch VALUES (?,?)");
mysqli_stmt_bind_param($stmt, "sb", $c1, $c2);
$stmt = mysqli_prepare ($link, "INSERT INTO test_bind_fetch VALUES (?,?)");
mysqli_stmt_bind_param($stmt, "sb", $c1, $c2);
$c1 = "Hello World";
$c1 = "Hello World";
mysqli_stmt_send_long_data($stmt, 1, "This is the first sentence.");
mysqli_stmt_send_long_data($stmt, 1, " And this is the second sentence.");
mysqli_stmt_send_long_data($stmt, 1, " And finally this is the last sentence.");
mysqli_stmt_send_long_data($stmt, 1, "This is the first sentence.");
mysqli_stmt_send_long_data($stmt, 1, " And this is the second sentence.");
mysqli_stmt_send_long_data($stmt, 1, " And finally this is the last sentence.");
mysqli_stmt_execute($stmt);
mysqli_stmt_close($stmt);
mysqli_stmt_execute($stmt);
mysqli_stmt_close($stmt);
$stmt = mysqli_prepare($link, "SELECT * FROM test_bind_fetch");
mysqli_stmt_bind_result($stmt, $d1, $d2);
mysqli_stmt_execute($stmt);
mysqli_stmt_fetch($stmt);
$stmt = mysqli_prepare($link, "SELECT * FROM test_bind_fetch");
mysqli_stmt_bind_result($stmt, $d1, $d2);
mysqli_stmt_execute($stmt);
mysqli_stmt_fetch($stmt);
$test = array($d1,$d2);
$test = array($d1,$d2);
var_dump($test);
var_dump($test);
mysqli_stmt_close($stmt);
mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch");
mysqli_close($link);
print "done!";
mysqli_stmt_close($stmt);
mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch");
mysqli_close($link);
print "done!";
?>
--CLEAN--
<?php
@@ -51,7 +51,7 @@ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
printf("[c001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
if (!mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch"))
printf("[c002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
printf("[c002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
mysqli_close($link);
?>
+7 -7
View File
@@ -7,17 +7,17 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
require_once("connect.inc");
require_once("connect.inc");
/*** test mysqli_connect 127.0.0.1 ***/
$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
/*** test mysqli_connect 127.0.0.1 ***/
$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
$status = mysqli_stat($link);
$status = mysqli_stat($link);
var_dump(strlen($status) > 0);
var_dump(strlen($status) > 0);
mysqli_close($link);
print "done!";
mysqli_close($link);
print "done!";
?>
--EXPECT--
bool(true)
+7 -7
View File
@@ -7,17 +7,17 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
require_once("connect.inc");
require_once("connect.inc");
/*** test mysqli_connect 127.0.0.1 ***/
$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
/*** test mysqli_connect 127.0.0.1 ***/
$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
$cset = substr(mysqli_character_set_name($link),0,6);
$cset = substr(mysqli_character_set_name($link),0,6);
var_dump($cset);
var_dump($cset);
mysqli_close($link);
print "done!";
mysqli_close($link);
print "done!";
?>
--EXPECTF--
string(%d) "%s"
+13 -13
View File
@@ -7,24 +7,24 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
require_once("connect.inc");
require_once("connect.inc");
/*** test mysqli_connect 127.0.0.1 ***/
$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
/*** test mysqli_connect 127.0.0.1 ***/
$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
mysqli_select_db($link, $db);
mysqli_select_db($link, $db);
mysqli_query($link, "DROP TABLE IF EXISTS general_test");
mysqli_query($link, "CREATE TABLE general_test (a INT)");
mysqli_query($link, "INSERT INTO general_test VALUES (1),(2),(3)");
mysqli_query($link, "DROP TABLE IF EXISTS general_test");
mysqli_query($link, "CREATE TABLE general_test (a INT)");
mysqli_query($link, "INSERT INTO general_test VALUES (1),(2),(3)");
$afc = mysqli_affected_rows($link);
$afc = mysqli_affected_rows($link);
var_dump($afc);
var_dump($afc);
mysqli_query($link, "DROP TABLE IF EXISTS general_test");
mysqli_close($link);
print "done!";
mysqli_query($link, "DROP TABLE IF EXISTS general_test");
mysqli_close($link);
print "done!";
?>
--CLEAN--
<?php
@@ -33,7 +33,7 @@ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
printf("[c001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
if (!mysqli_query($link, "DROP TABLE IF EXISTS general_test"))
printf("[c002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
printf("[c002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
mysqli_close($link);
?>
+11 -11
View File
@@ -7,22 +7,22 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
require_once("connect.inc");
require_once("connect.inc");
/*** test mysqli_connect 127.0.0.1 ***/
$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
$errno = mysqli_errno($link);
var_dump($errno);
/*** test mysqli_connect 127.0.0.1 ***/
$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
$errno = mysqli_errno($link);
var_dump($errno);
mysqli_select_db($link, $db);
mysqli_select_db($link, $db);
mysqli_query($link, "SELECT * FROM non_exisiting_table");
$errno = mysqli_errno($link);
mysqli_query($link, "SELECT * FROM non_exisiting_table");
$errno = mysqli_errno($link);
var_dump($errno);
var_dump($errno);
mysqli_close($link);
print "done!";
mysqli_close($link);
print "done!";
?>
--EXPECT--
int(0)
+11 -11
View File
@@ -7,22 +7,22 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
require_once("connect.inc");
require_once("connect.inc");
/*** test mysqli_connect 127.0.0.1 ***/
$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
$error = mysqli_error($link);
var_dump($error);
/*** test mysqli_connect 127.0.0.1 ***/
$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
$error = mysqli_error($link);
var_dump($error);
mysqli_select_db($link, $db);
mysqli_select_db($link, $db);
mysqli_query($link, "SELECT * FROM non_exisiting_table");
$error = mysqli_error($link);
mysqli_query($link, "SELECT * FROM non_exisiting_table");
$error = mysqli_error($link);
var_dump($error);
var_dump($error);
mysqli_close($link);
print "done!";
mysqli_close($link);
print "done!";
?>
--EXPECTF--
string(0) ""
+13 -13
View File
@@ -7,24 +7,24 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
require_once("connect.inc");
require_once("connect.inc");
/*** test mysqli_connect 127.0.0.1 ***/
$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
/*** test mysqli_connect 127.0.0.1 ***/
$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
mysqli_select_db($link, $db);
mysqli_select_db($link, $db);
mysqli_query($link, "DROP TABLE IF EXISTS general_test");
mysqli_query($link, "CREATE TABLE general_test (a INT)");
mysqli_query($link, "INSERT INTO general_test VALUES (1),(2),(3)");
mysqli_query($link, "DROP TABLE IF EXISTS general_test");
mysqli_query($link, "CREATE TABLE general_test (a INT)");
mysqli_query($link, "INSERT INTO general_test VALUES (1),(2),(3)");
$afc = mysqli_info($link);
$afc = mysqli_info($link);
var_dump($afc);
var_dump($afc);
mysqli_query($link, "DROP TABLE IF EXISTS general_test");
mysqli_close($link);
print "done!";
mysqli_query($link, "DROP TABLE IF EXISTS general_test");
mysqli_close($link);
print "done!";
?>
--CLEAN--
<?php
@@ -33,7 +33,7 @@ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
printf("[c001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
if (!mysqli_query($link, "DROP TABLE IF EXISTS general_test"))
printf("[c002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
printf("[c002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
mysqli_close($link);
?>
+7 -7
View File
@@ -8,17 +8,17 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
require_once("connect.inc");
require_once("connect.inc");
/*** test mysqli_connect 127.0.0.1 ***/
$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
/*** test mysqli_connect 127.0.0.1 ***/
$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
$hinfo = mysqli_get_host_info($link);
$hinfo = mysqli_get_host_info($link);
var_dump(str_replace('/','', $hinfo));
var_dump(str_replace('/','', $hinfo));
mysqli_close($link);
print "done!";
mysqli_close($link);
print "done!";
?>
--EXPECTF--
string(%d) "%s via %s"
+7 -7
View File
@@ -8,17 +8,17 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
require_once("connect.inc");
require_once("connect.inc");
/*** test mysqli_connect 127.0.0.1 ***/
$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
/*** test mysqli_connect 127.0.0.1 ***/
$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
$pinfo = mysqli_get_proto_info($link);
$pinfo = mysqli_get_proto_info($link);
var_dump($pinfo);
var_dump($pinfo);
mysqli_close($link);
print "done!";
mysqli_close($link);
print "done!";
?>
--EXPECT--
int(10)
+7 -7
View File
@@ -7,17 +7,17 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
require_once("connect.inc");
require_once("connect.inc");
/*** test mysqli_connect 127.0.0.1 ***/
$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
/*** test mysqli_connect 127.0.0.1 ***/
$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
$sinfo = substr(mysqli_get_server_info($link),0,1);
$sinfo = substr(mysqli_get_server_info($link),0,1);
var_dump(strlen($sinfo));
var_dump(strlen($sinfo));
mysqli_close($link);
print "done!";
mysqli_close($link);
print "done!";
?>
--EXPECT--
int(1)
+29 -29
View File
@@ -2,45 +2,45 @@
function test: mysqli_insert_id()
--SKIPIF--
<?php
if (PHP_INT_SIZE == 8) {
echo 'skip test valid only for 32bit systems';
exit;
}
require_once('skipif.inc');
require_once('skipifconnectfailure.inc');
if (PHP_INT_SIZE == 8) {
echo 'skip test valid only for 32bit systems';
exit;
}
require_once('skipif.inc');
require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
require_once("connect.inc");
require_once("connect.inc");
/*** test mysqli_connect 127.0.0.1 ***/
$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
/*** test mysqli_connect 127.0.0.1 ***/
$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
mysqli_select_db($link, $db);
mysqli_select_db($link, $db);
mysqli_query($link, "DROP TABLE IF EXISTS t036");
mysqli_query($link, "CREATE TABLE t036 (a bigint not null auto_increment primary key, b varchar(10)) ENGINE = " . $engine);
mysqli_query($link, "DROP TABLE IF EXISTS t036");
mysqli_query($link, "CREATE TABLE t036 (a bigint not null auto_increment primary key, b varchar(10)) ENGINE = " . $engine);
mysqli_query($link, "INSERT INTO t036 (b) VALUES ('foo1')");
$test[] = mysqli_insert_id($link);
mysqli_query($link, "INSERT INTO t036 (b) VALUES ('foo1')");
$test[] = mysqli_insert_id($link);
/* we have to insert more values, cause lexer sets auto_increment to max_int
see mysql bug #54. So we don't check for the value, only for type (which must
be type string)
*/
/* we have to insert more values, cause lexer sets auto_increment to max_int
see mysql bug #54. So we don't check for the value, only for type (which must
be type string)
*/
mysqli_query($link, "ALTER TABLE t036 AUTO_INCREMENT=9999999999999998");
mysqli_query($link, "INSERT INTO t036 (b) VALUES ('foo2')");
mysqli_query($link, "INSERT INTO t036 (b) VALUES ('foo3')");
mysqli_query($link, "INSERT INTO t036 (b) VALUES ('foo4')");
$x = mysqli_insert_id($link);
$test[] = is_string($x);
mysqli_query($link, "ALTER TABLE t036 AUTO_INCREMENT=9999999999999998");
mysqli_query($link, "INSERT INTO t036 (b) VALUES ('foo2')");
mysqli_query($link, "INSERT INTO t036 (b) VALUES ('foo3')");
mysqli_query($link, "INSERT INTO t036 (b) VALUES ('foo4')");
$x = mysqli_insert_id($link);
$test[] = is_string($x);
var_dump($test);
var_dump($test);
mysqli_query($link, "DROP TABLE IF EXISTS t036");
mysqli_close($link);
print "done!";
mysqli_query($link, "DROP TABLE IF EXISTS t036");
mysqli_close($link);
print "done!";
?>
--CLEAN--
<?php
@@ -49,7 +49,7 @@ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
printf("[c001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
if (!mysqli_query($link, "DROP TABLE IF EXISTS t036"))
printf("[c002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
printf("[c002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
mysqli_close($link);
?>
+15 -15
View File
@@ -8,29 +8,29 @@ require_once('skipifconnectfailure.inc');
--FILE--
<?php
require_once("connect.inc");
require_once("connect.inc");
/*** test mysqli_connect 127.0.0.1 ***/
$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
/*** test mysqli_connect 127.0.0.1 ***/
$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
mysqli_select_db($link, $db);
mysqli_select_db($link, $db);
mysqli_query($link, "DROP TABLE IF EXISTS test_result");
mysqli_query($link, "DROP TABLE IF EXISTS test_result");
mysqli_query($link, "CREATE TABLE test_result (a int, b varchar(10)) ENGINE = " . $engine);
mysqli_query($link, "CREATE TABLE test_result (a int, b varchar(10)) ENGINE = " . $engine);
mysqli_query($link, "INSERT INTO test_result VALUES (1, 'foo')");
$ir[] = mysqli_field_count($link);
mysqli_query($link, "INSERT INTO test_result VALUES (1, 'foo')");
$ir[] = mysqli_field_count($link);
mysqli_real_query($link, "SELECT * FROM test_result");
$ir[] = mysqli_field_count($link);
mysqli_real_query($link, "SELECT * FROM test_result");
$ir[] = mysqli_field_count($link);
var_dump($ir);
var_dump($ir);
mysqli_query($link, "DROP TABLE IF EXISTS test_result");
mysqli_close($link);
print "done!";
mysqli_query($link, "DROP TABLE IF EXISTS test_result");
mysqli_close($link);
print "done!";
?>
--CLEAN--
<?php
@@ -39,7 +39,7 @@ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
printf("[c001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
if (!mysqli_query($link, "DROP TABLE IF EXISTS test_result"))
printf("[c002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
printf("[c002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
mysqli_close($link);
?>
+17 -17
View File
@@ -7,30 +7,30 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
require_once("connect.inc");
require_once("connect.inc");
/*** test mysqli_connect 127.0.0.1 ***/
$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
/*** test mysqli_connect 127.0.0.1 ***/
$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
mysqli_select_db($link, $db);
mysqli_select_db($link, $db);
mysqli_query($link, "DROP TABLE IF EXISTS test_result");
mysqli_query($link, "DROP TABLE IF EXISTS test_result");
mysqli_query($link, "CREATE TABLE test_result (a int, b varchar(10)) ENGINE = " . $engine);
mysqli_query($link, "CREATE TABLE test_result (a int, b varchar(10)) ENGINE = " . $engine);
mysqli_query($link, "INSERT INTO test_result VALUES (1, 'foo')");
mysqli_query($link, "INSERT INTO test_result VALUES (1, 'foo')");
mysqli_real_query($link, "SELECT * FROM test_result");
if (mysqli_field_count($link)) {
$result = mysqli_store_result($link);
$num = mysqli_num_fields($result);
mysqli_free_result($result);
}
mysqli_real_query($link, "SELECT * FROM test_result");
if (mysqli_field_count($link)) {
$result = mysqli_store_result($link);
$num = mysqli_num_fields($result);
mysqli_free_result($result);
}
var_dump($num);
var_dump($num);
mysqli_query($link, "DROP TABLE IF EXISTS test_result");
mysqli_close($link);
mysqli_query($link, "DROP TABLE IF EXISTS test_result");
mysqli_close($link);
?>
--CLEAN--
<?php
@@ -39,7 +39,7 @@ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
printf("[c001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
if (!mysqli_query($link, "DROP TABLE IF EXISTS test_result"))
printf("[c002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
printf("[c002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
mysqli_close($link);
?>
+12 -12
View File
@@ -7,23 +7,23 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
require_once("connect.inc");
require_once("connect.inc");
/*** test mysqli_connect 127.0.0.1 ***/
$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
/*** test mysqli_connect 127.0.0.1 ***/
$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
mysqli_real_query($link, "SHOW VARIABLES");
mysqli_real_query($link, "SHOW VARIABLES");
if (mysqli_field_count($link)) {
$result = mysqli_store_result($link);
$num = mysqli_num_fields($result);
mysqli_free_result($result);
}
if (mysqli_field_count($link)) {
$result = mysqli_store_result($link);
$num = mysqli_num_fields($result);
mysqli_free_result($result);
}
var_dump($num);
var_dump($num);
mysqli_close($link);
print "done!";
mysqli_close($link);
print "done!";
?>
--EXPECT--
int(2)
+18 -18
View File
@@ -7,29 +7,29 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
require_once("connect.inc");
require_once("connect.inc");
/*** test mysqli_connect 127.0.0.1 ***/
$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
/*** test mysqli_connect 127.0.0.1 ***/
$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
mysqli_select_db($link, $db);
mysqli_select_db($link, $db);
mysqli_query($link, "DROP TABLE IF EXISTS test_result");
mysqli_query($link, "CREATE TABLE test_result (a int, b varchar(10)) ENGINE=" . $engine);
mysqli_query($link, "INSERT INTO test_result VALUES (1, 'foo')");
mysqli_query($link, "DROP TABLE IF EXISTS test_result");
mysqli_query($link, "CREATE TABLE test_result (a int, b varchar(10)) ENGINE=" . $engine);
mysqli_query($link, "INSERT INTO test_result VALUES (1, 'foo')");
mysqli_real_query($link, "SELECT * FROM test_result");
if (mysqli_field_count($link)) {
$result = mysqli_store_result($link);
$num = mysqli_num_rows($result);
mysqli_free_result($result);
}
mysqli_real_query($link, "SELECT * FROM test_result");
if (mysqli_field_count($link)) {
$result = mysqli_store_result($link);
$num = mysqli_num_rows($result);
mysqli_free_result($result);
}
var_dump($num);
var_dump($num);
mysqli_query($link, "DROP TABLE IF EXISTS test_result");
mysqli_close($link);
print "done!";
mysqli_query($link, "DROP TABLE IF EXISTS test_result");
mysqli_close($link);
print "done!";
?>
--CLEAN--
<?php
@@ -38,7 +38,7 @@ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
printf("[c001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
if (!mysqli_query($link, "DROP TABLE IF EXISTS test_result"))
printf("[c002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
printf("[c002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
mysqli_close($link);
?>
Loaded 100 of 611 files, more files were not shown because too many files have changed in this diff. Show more