@@ -844,10 +844,13 @@ static void php_dba_open(INTERNAL_FUNCTION_PARAMETERS, bool persistent)
844844 connection -> info -> lock .fp = php_stream_open_wrapper (lock_name , lock_file_mode , STREAM_MUST_SEEK |REPORT_ERRORS |IGNORE_PATH |persistent_flag , & opened_path );
845845 if (connection -> info -> lock .fp ) {
846846 if (is_db_lock ) {
847- ZEND_ASSERT (opened_path );
848- /* replace the path info with the real path of the opened file */
849- zend_string_release_ex (connection -> info -> path , persistent );
850- connection -> info -> path = php_dba_zend_string_dup_safe (opened_path , persistent );
847+ if (opened_path ) {
848+ /* replace the path info with the real path of the opened file */
849+ zend_string_release_ex (connection -> info -> path , persistent );
850+ connection -> info -> path = php_dba_zend_string_dup_safe (opened_path , persistent );
851+ } else {
852+ error = "Unable to determine path for locking" ;
853+ }
851854 }
852855 }
853856 if (opened_path ) {
@@ -864,10 +867,10 @@ static void php_dba_open(INTERNAL_FUNCTION_PARAMETERS, bool persistent)
864867 zval_ptr_dtor (return_value );
865868 RETURN_FALSE ;
866869 }
867- if (!php_stream_supports_lock (connection -> info -> lock .fp )) {
870+ if (!error && ! php_stream_supports_lock (connection -> info -> lock .fp )) {
868871 error = "Stream does not support locking" ;
869872 }
870- if (php_stream_lock (connection -> info -> lock .fp , lock_mode )) {
873+ if (! error && php_stream_lock (connection -> info -> lock .fp , lock_mode )) {
871874 error = "Unable to establish lock" ; /* force failure exit */
872875 }
873876 }
0 commit comments